def test_best_ckpt_evaluate_raises_warning_with_multiple_ckpt_callbacks():
    """Test that a warning is raised if best ckpt callback is used for evaluation configured with multiple
    checkpoints."""

    ckpt_callback1 = ModelCheckpoint(monitor="foo")
    ckpt_callback1.best_model_path = "foo_best_model.ckpt"
    ckpt_callback2 = ModelCheckpoint(monitor="bar")
    ckpt_callback2.best_model_path = "bar_best_model.ckpt"
    trainer = Trainer(callbacks=[ckpt_callback1, ckpt_callback2])
    trainer.state.fn = TrainerFn.TESTING

    with pytest.warns(UserWarning, match="best checkpoint path from first checkpoint callback"):
        trainer._checkpoint_connector._parse_ckpt_path(
            trainer.state.fn, ckpt_path="best", model_provided=False, model_connected=True
        )
Test that a warning is raised if best ckpt callback is used for evaluation configured with multiple
    checkpoints.
tests/tests_pytorch/trainer/test_trainer.py