def test_get_progress_bar_metrics(tmp_path):
    """Test that the metrics shown in the progress bar can be customized."""

    class TestProgressBar(TQDMProgressBar):
        def get_metrics(self, trainer: Trainer, model: LightningModule):
            items = super().get_metrics(trainer, model)
            items.pop("v_num", None)
            items["my_metric"] = 123
            return items

    progress_bar = TestProgressBar()
    trainer = Trainer(
        default_root_dir=tmp_path,
        callbacks=[progress_bar],
        limit_train_batches=1,
        limit_val_batches=1,
        max_epochs=1,
        enable_checkpointing=False,
        enable_model_summary=False,
    )
    model = BoringModel()
    trainer.fit(model)
    standard_metrics = progress_bar.get_metrics(trainer, model)
    assert "v_num" not in standard_metrics
    assert "my_metric" in standard_metrics
Test that the metrics shown in the progress bar can be customized.
tests/tests_pytorch/callbacks/progress/test_tqdm_progress_bar.py