mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Add a new function imp.lock_held(), and use it to skip test_threaded_import
when that test is doomed to deadlock.
This commit is contained in:
parent
c41418751f
commit
692323488b
4 changed files with 47 additions and 4 deletions
|
@ -32,10 +32,12 @@ def task():
|
|||
|
||||
def test_main(): # magic name! see above
|
||||
global N, done
|
||||
import sys
|
||||
for modname in sys.modules:
|
||||
if modname.find('autotest') >= 0:
|
||||
raise TestSkipped("can't run from autotest")
|
||||
|
||||
import imp
|
||||
if imp.lock_held():
|
||||
# This triggers on, e.g., from test import autotest.
|
||||
raise TestSkipped("can't run when import lock is held")
|
||||
|
||||
done.acquire()
|
||||
for N in (20, 50) * 3:
|
||||
if verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue