Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make sure test cleans up and doesn't race.
  • Loading branch information
markshannon committed Jul 15, 2021
commit e52abd2e97684a96d9a37b4b33d781010c582ee1
7 changes: 6 additions & 1 deletion Lib/test/test_threading.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,17 +1604,22 @@ def test_interrupt_main_invalid_signal(self):
self.assertRaises(ValueError, _thread.interrupt_main, signal.NSIG)
self.assertRaises(ValueError, _thread.interrupt_main, 1000000)

@threading_helper.reap_threads
def test_can_interrupt_tight_loops(self):
#Nothing to assert here. It just shouldn't hang.

cont = True
started = False
def worker():
nonlocal started
started = True
while cont:
pass

t = threading.Thread(target=worker)
t.start()
time.sleep(0.1)
while not started:
pass
cont = False
t.join()

Expand Down