summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threaded_import.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-08-30 05:16:13 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-08-30 05:16:13 (GMT)
commit692323488baf518117d3ede90189812723f39948 (patch)
tree8401474367a2c7684060b891da495cfb025e9bd5 /Lib/test/test_threaded_import.py
parentc41418751fcef0a42f336ba91871827b45d558a7 (diff)
downloadcpython-692323488baf518117d3ede90189812723f39948.zip
cpython-692323488baf518117d3ede90189812723f39948.tar.gz
cpython-692323488baf518117d3ede90189812723f39948.tar.bz2
Add a new function imp.lock_held(), and use it to skip test_threaded_import
when that test is doomed to deadlock.
Diffstat (limited to 'Lib/test/test_threaded_import.py')
-rw-r--r--Lib/test/test_threaded_import.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index 1e1c553..e022c5f 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -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: