Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/tests_lite/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
7 changes: 7 additions & 0 deletions tests/tests_pytorch/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down