Skip to content

Commit 1e1645e

Browse files
committed
test: fix flaky threading test
1 parent 5d6cf7e commit 1e1645e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

.claude/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"Bash(grep:*)",
3030
"Bash(mv:*)",
3131
"Bash(source .venv/bin/activate)",
32+
"Bash(source tox.venv/bin/activate:*)",
3233
"Bash(tox:*)",
3334
"Bash(tox.venv/bin/tox:*)",
3435
"Bash(.tox/*/bin/python:*)",

tests/test_utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import pytest
88

99
import sentry_sdk
10-
from sentry_sdk._compat import PY38
1110
from sentry_sdk.integrations import Integration
1211
from sentry_sdk._queue import Queue
1312
from sentry_sdk.utils import (
@@ -942,14 +941,12 @@ def target():
942941
assert (main_thread.ident, main_thread.name) == results.get(timeout=1)
943942

944943

945-
@pytest.mark.skipif(PY38, reason="Flakes a lot on 3.8 in CI.")
946944
def test_get_current_thread_meta_failed_to_get_main_thread():
947945
results = Queue(maxsize=1)
948946

949947
def target():
950-
with mock.patch("threading.current_thread", side_effect=["fake thread"]):
951-
with mock.patch("threading.current_thread", side_effect=["fake thread"]):
952-
results.put(get_current_thread_meta())
948+
with mock.patch("threading.current_thread", return_value="fake thread"):
949+
results.put(get_current_thread_meta())
953950

954951
main_thread = threading.main_thread()
955952

0 commit comments

Comments
 (0)