move progress bar test to correct test folder (#5667)

This commit is contained in:
Adrian Wälchli 2021-01-27 09:52:14 +01:00 committed by Jirka Borovec
parent e1e47ac628
commit 1feff5d774
2 changed files with 23 additions and 1 deletions

View File

@ -0,0 +1,22 @@
import pytest
from pytorch_lightning import Trainer
from tests.base import BoringModel
def test_logging_to_progress_bar_with_reserved_key(tmpdir):
""" Test that logging a metric with a reserved name to the progress bar raises a warning. """
class TestModel(BoringModel):
def training_step(self, *args, **kwargs):
output = super().training_step(*args, **kwargs)
self.log("loss", output["loss"], prog_bar=True)
return output
model = TestModel()
trainer = Trainer(
default_root_dir=tmpdir,
max_steps=2,
)
with pytest.warns(UserWarning, match="The progress bar already tracks a metric with the .* 'loss'"):
trainer.fit(model)