Skip to content

Commit

Permalink
Replace deprecated pytest.warns(None) (#922)
Browse files Browse the repository at this point in the history
Replace the deprecated `pytest.warns(None)` with the standard library
`warnings.catch_warnings(record=True)`, in order to fix compatibility
with pytest-8.1.2.

Co-authored-by: michaelboulton <[email protected]>
  • Loading branch information
mgorny and michaelboulton authored May 11, 2024
1 parent a78f276 commit 89f2a84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/unit/test_call_run.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -35,7 +36,7 @@ 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(record=True) as warn_rec:
run("", **kw)

assert not len(warn_rec)
Expand Down

0 comments on commit 89f2a84

Please sign in to comment.