def test_num_stepping_batches_raises_info_with_no_dataloaders_loaded(caplog):
    """Test that an info message is generated when dataloaders are loaded explicitly if they are not already
    configured."""
    trainer = Trainer(max_epochs=1)
    model = BoringModel()
    trainer._data_connector.attach_data(model)
    trainer.strategy.connect(model)

    # artificially setup the data
    trainer.fit_loop.setup_data()

    with caplog.at_level(logging.INFO):
        assert trainer.estimated_stepping_batches == 64

    message = "to estimate number of stepping batches"
    assert message not in caplog.text

    trainer = Trainer(max_epochs=1)
    model = BoringModel()
    trainer._data_connector.attach_data(model)
    trainer.strategy.connect(model)

    with caplog.at_level(logging.INFO):
        assert trainer.estimated_stepping_batches == 64

    assert message in caplog.text
Test that an info message is generated when dataloaders are loaded explicitly if they are not already
    configured.
tests/tests_pytorch/trainer/properties/test_estimated_stepping_batches.py