Skip to content

Commit ad80fa9

Browse files
committed
fix: Fix other test too
1 parent 1f92e99 commit ad80fa9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

tests/utils/test_contextvars.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@
88
from sentry_sdk.utils import _is_threading_local_monkey_patched
99

1010

11+
def try_gevent_patch_all():
12+
try:
13+
gevent.monkey.patch_all()
14+
except Exception as e:
15+
if "_RLock__owner" in str(e):
16+
pytest.skip("https://github.com/gevent/gevent/issues/1380")
17+
else:
18+
raise
19+
20+
1121
def test_gevent_is_patched():
12-
gevent.monkey.patch_all()
22+
try_gevent_patch_all()
1323
assert _is_threading_local_monkey_patched()
1424

1525

@@ -20,13 +30,7 @@ def test_gevent_is_not_patched():
2030
@pytest.mark.parametrize("with_gevent", [True, False])
2131
def test_leaks(with_gevent):
2232
if with_gevent:
23-
try:
24-
gevent.monkey.patch_all()
25-
except Exception as e:
26-
if "_RLock__owner" in str(e):
27-
pytest.skip("https://github.com/gevent/gevent/issues/1380")
28-
else:
29-
raise
33+
try_gevent_patch_all()
3034

3135
import threading
3236

0 commit comments

Comments
 (0)