Skip to content

Commit 380d7b7

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

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -942,14 +942,12 @@ def target():
942942
assert (main_thread.ident, main_thread.name) == results.get(timeout=1)
943943

944944

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

949948
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())
949+
with mock.patch("threading.current_thread", return_value="fake thread"):
950+
results.put(get_current_thread_meta())
953951

954952
main_thread = threading.main_thread()
955953

0 commit comments

Comments
 (0)