From 9fc4ff3278ac360f2671549415f6b11689a263ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Tue, 27 Sep 2022 17:49:25 +0200 Subject: [PATCH] Move logic to error out on deprecation warnings into conftest (#14902) --- setup.cfg | 2 -- tests/tests_lite/conftest.py | 7 +++++++ tests/tests_pytorch/conftest.py | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 6007aec280..aa49d0fd4f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,8 +33,6 @@ addopts = markers = cloud:Run the cloud tests for example filterwarnings = - # error out on our deprecation warnings - ensures the code and tests are kept up-to-date - error::pytorch_lightning.utilities.rank_zero.LightningDeprecationWarning error::FutureWarning xfail_strict = true junit_duration_report = call diff --git a/tests/tests_lite/conftest.py b/tests/tests_lite/conftest.py index 952d32e4a9..c38d93ff24 100644 --- a/tests/tests_lite/conftest.py +++ b/tests/tests_lite/conftest.py @@ -144,3 +144,10 @@ def pytest_collection_modifyitems(items: List[pytest.Function], config: pytest.C bold=True, purple=True, # oh yeah, branded pytest messages ) + + # error out on our deprecation warnings - ensures the code and tests are kept up-to-date + deprecation_error = pytest.mark.filterwarnings( + "error::lightning_lite.utilities.rank_zero.LightningDeprecationWarning", + ) + for item in items: + item.add_marker(deprecation_error) diff --git a/tests/tests_pytorch/conftest.py b/tests/tests_pytorch/conftest.py index 252837889f..725953d992 100644 --- a/tests/tests_pytorch/conftest.py +++ b/tests/tests_pytorch/conftest.py @@ -260,6 +260,13 @@ def pytest_collection_modifyitems(items: List[pytest.Function], config: pytest.C purple=True, # oh yeah, branded pytest messages ) + # error out on our deprecation warnings - ensures the code and tests are kept up-to-date + deprecation_error = pytest.mark.filterwarnings( + "error::lightning_lite.utilities.rank_zero.LightningDeprecationWarning", + ) + for item in items: + item.add_marker(deprecation_error) + def pytest_addoption(parser): parser.addoption("--hpus", action="store", type=int, default=1, help="Number of hpus 1-8")