Skip to content

Commit 9fc4ff3

Browse files
authored
Move logic to error out on deprecation warnings into conftest (#14902)
1 parent d1a3a3e commit 9fc4ff3

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

setup.cfg

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ addopts =
3333
markers =
3434
cloud:Run the cloud tests for example
3535
filterwarnings =
36-
# error out on our deprecation warnings - ensures the code and tests are kept up-to-date
37-
error::pytorch_lightning.utilities.rank_zero.LightningDeprecationWarning
3836
error::FutureWarning
3937
xfail_strict = true
4038
junit_duration_report = call

tests/tests_lite/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,10 @@ def pytest_collection_modifyitems(items: List[pytest.Function], config: pytest.C
144144
bold=True,
145145
purple=True, # oh yeah, branded pytest messages
146146
)
147+
148+
# error out on our deprecation warnings - ensures the code and tests are kept up-to-date
149+
deprecation_error = pytest.mark.filterwarnings(
150+
"error::lightning_lite.utilities.rank_zero.LightningDeprecationWarning",
151+
)
152+
for item in items:
153+
item.add_marker(deprecation_error)

tests/tests_pytorch/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ def pytest_collection_modifyitems(items: List[pytest.Function], config: pytest.C
260260
purple=True, # oh yeah, branded pytest messages
261261
)
262262

263+
# error out on our deprecation warnings - ensures the code and tests are kept up-to-date
264+
deprecation_error = pytest.mark.filterwarnings(
265+
"error::lightning_lite.utilities.rank_zero.LightningDeprecationWarning",
266+
)
267+
for item in items:
268+
item.add_marker(deprecation_error)
269+
263270

264271
def pytest_addoption(parser):
265272
parser.addoption("--hpus", action="store", type=int, default=1, help="Number of hpus 1-8")

0 commit comments

Comments
 (0)