Skip to content

Commit

Permalink
Stop leaking a thread in test_race_between_idle_exit_and_job_assignment
Browse files Browse the repository at this point in the history
It can lead to confusion, e.g.: python-trio#1604
  • Loading branch information
njsmith committed Jun 10, 2020
1 parent ffb1b12 commit 236118e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions trio/_core/tests/test_thread_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import threading
from queue import Queue
import time
import sys

from .tutil import slow
from .. import _thread_cache
Expand Down Expand Up @@ -118,3 +119,9 @@ def release(self):
done = threading.Event()
tc.start_thread_soon(lambda: None, lambda _: done.set())
done.wait()
# Let's kill the thread we started, so it doesn't hang around until the
# test suite finishes. Doesn't really do any harm, but it can be confusing
# to see it in debug output. This is hacky, and leaves our ThreadCache
# object in an inconsistent state... but it doesn't matter, because we're
# not going to use it again anyway.
tc.start_thread_soon(lambda: None, lambda _: sys.exit())

0 comments on commit 236118e

Please sign in to comment.