def test_tqdm_progress_bar_print_disabled(tqdm_write, mock_print, tmp_path):
    """Test that printing in LightningModule goes through built-in print function when progress bar is disabled."""
    model = PrintModel()
    bar = TQDMProgressBar()
    trainer = Trainer(
        default_root_dir=tmp_path,
        num_sanity_val_steps=0,
        limit_train_batches=1,
        limit_val_batches=1,
        limit_test_batches=1,
        limit_predict_batches=1,
        max_steps=1,
        callbacks=[bar],
    )
    bar.disable()
    trainer.fit(model)
    trainer.test(model, verbose=False)
    trainer.predict(model)

    mock_print.assert_has_calls([
        call("training_step", end=""),
        call("validation_step", file=ANY),
        call("test_step"),
        call("predict_step"),
    ])
    tqdm_write.assert_not_called()
Test that printing in LightningModule goes through built-in print function when progress bar is disabled.
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py