Move logic to error out on deprecation warnings into conftest (#14902)

This commit is contained in:
Carlos Mocholí 2022-09-27 17:49:25 +02:00 committed by GitHub
parent d1a3a3ebf5
commit 9fc4ff3278
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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")