def test_attach_model_callbacks_override_info(caplog):
    """Test that the logs contain the info about overriding callbacks returned by configure_callbacks."""
    model = LightningModule()
    model.configure_callbacks = lambda: [LearningRateMonitor(), EarlyStopping(monitor="foo")]
    trainer = Trainer(
        enable_checkpointing=False, callbacks=[EarlyStopping(monitor="foo"), LearningRateMonitor(), TQDMProgressBar()]
    )
    trainer.strategy._lightning_module = model
    cb_connector = _CallbackConnector(trainer)
    with caplog.at_level(logging.INFO):
        cb_connector._attach_model_callbacks()

    assert "existing callbacks passed to Trainer: EarlyStopping, LearningRateMonitor" in caplog.text
Test that the logs contain the info about overriding callbacks returned by configure_callbacks.
tests/tests_pytorch/trainer/connectors/test_callback_connector.py