mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Issue #22853: Added regression test for using multiprocessing.Queue at import
time. Patch by Davin Potts.
This commit is contained in:
parent
c19ed37579
commit
f8904e99c7
1 changed files with 21 additions and 0 deletions
|
@ -713,6 +713,27 @@ class _TestQueue(BaseTestCase):
|
||||||
for p in workers:
|
for p in workers:
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
|
def test_no_import_lock_contention(self):
|
||||||
|
with test.support.temp_cwd():
|
||||||
|
module_name = 'imported_by_an_imported_module'
|
||||||
|
with open(module_name + '.py', 'w') as f:
|
||||||
|
f.write("""if 1:
|
||||||
|
import multiprocessing
|
||||||
|
|
||||||
|
q = multiprocessing.Queue()
|
||||||
|
q.put('knock knock')
|
||||||
|
q.get(timeout=3)
|
||||||
|
q.close()
|
||||||
|
del q
|
||||||
|
""")
|
||||||
|
|
||||||
|
with test.support.DirsOnSysPath(os.getcwd()):
|
||||||
|
try:
|
||||||
|
__import__(module_name)
|
||||||
|
except pyqueue.Empty:
|
||||||
|
self.fail("Probable regression on import lock contention;"
|
||||||
|
" see Issue #22853")
|
||||||
|
|
||||||
def test_timeout(self):
|
def test_timeout(self):
|
||||||
q = multiprocessing.Queue()
|
q = multiprocessing.Queue()
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue