Skip to content

Commit d97e7d7

Browse files
test: Fix pytest error (#2712)
The ability to pass None to pytest.capture_warnings was removed in pytest version 8.0.0. To validate that this fix, one can run any of the test cases with pytest==8.0.0. Without this change, the test immediately fails with an error; with the change, the test suite runs as expected. Fixes GH-2693
1 parent 60e644c commit d97e7d7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sys
2-
3-
import pytest
2+
import warnings
43

54
# This is used in _capture_internal_warnings. We need to run this at import
65
# time because that's where many deprecation warnings might get thrown.
@@ -9,5 +8,5 @@
98
# gets loaded too late.
109
assert "sentry_sdk" not in sys.modules
1110

12-
_warning_recorder_mgr = pytest.warns(None)
11+
_warning_recorder_mgr = warnings.catch_warnings(record=True)
1312
_warning_recorder = _warning_recorder_mgr.__enter__()

0 commit comments

Comments
 (0)