mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-40275: Adding threading_helper submodule in test.support (GH-20263)
This commit is contained in:
parent
7d80b35af1
commit
e80697d687
46 changed files with 483 additions and 428 deletions
|
@ -7,6 +7,7 @@ import time
|
|||
import unittest
|
||||
import weakref
|
||||
from test import support
|
||||
from test.support import threading_helper
|
||||
|
||||
py_queue = support.import_fresh_module('queue', blocked=['_queue'])
|
||||
c_queue = support.import_fresh_module('queue', fresh=['_queue'])
|
||||
|
@ -63,7 +64,7 @@ class BlockingTestMixin:
|
|||
block_func)
|
||||
return self.result
|
||||
finally:
|
||||
support.join_thread(thread) # make sure the thread terminates
|
||||
threading_helper.join_thread(thread) # make sure the thread terminates
|
||||
|
||||
# Call this instead if block_func is supposed to raise an exception.
|
||||
def do_exceptional_blocking_test(self,block_func, block_args, trigger_func,
|
||||
|
@ -79,7 +80,7 @@ class BlockingTestMixin:
|
|||
self.fail("expected exception of kind %r" %
|
||||
expected_exception_class)
|
||||
finally:
|
||||
support.join_thread(thread) # make sure the thread terminates
|
||||
threading_helper.join_thread(thread) # make sure the thread terminates
|
||||
if not thread.startedEvent.is_set():
|
||||
self.fail("trigger thread ended but event never set")
|
||||
|
||||
|
@ -484,7 +485,7 @@ class BaseSimpleQueueTest:
|
|||
args=(q, results, sentinel))
|
||||
for i in range(n_consumers)]
|
||||
|
||||
with support.start_threads(feeders + consumers):
|
||||
with threading_helper.start_threads(feeders + consumers):
|
||||
pass
|
||||
|
||||
self.assertFalse(exceptions)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue