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:
Tim Peters 2001-08-30 05:16:13 +00:00
parent c41418751f
commit 692323488b
4 changed files with 47 additions and 4 deletions

View file

@ -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: