Skip to content

Commit

Permalink
test: Fix pytest error (#2712)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
szokeasaurusrex committed Feb 6, 2024
1 parent 60e644c commit d97e7d7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys

import pytest
import warnings

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

_warning_recorder_mgr = pytest.warns(None)
_warning_recorder_mgr = warnings.catch_warnings(record=True)
_warning_recorder = _warning_recorder_mgr.__enter__()

0 comments on commit d97e7d7

Please sign in to comment.