Skip to content

Commit

Permalink
Replace deprecated pytest.warns(None)
Browse files Browse the repository at this point in the history
Replace the deprecated `pytest.warns(None)` use with the `error` warning
filter, as recommended
in pytest-dev/pytest#9404 (comment).
With this change, the tests pass with pytest-8.1.1.
  • Loading branch information
mgorny committed Mar 28, 2024
1 parent 7439490 commit 3aa8cc9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/unit/test_call_run.py
@@ -1,3 +1,4 @@
import warnings
from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -35,11 +36,10 @@ def test_run_with_cfg(self):
)
def test_doesnt_warn_about_expected_kwargs(self, expected_kwarg):
kw = {expected_kwarg: 123}
with pytest.warns(None) as warn_rec:
with warnings.catch_warnings():
warnings.simplefilter("error")
run("", **kw)

assert not len(warn_rec)


class TestParseGlobalCfg:
def test_path_correct(self):
Expand Down

0 comments on commit 3aa8cc9

Please sign in to comment.