pypy/module/thread/test/test_import_lock.py::AppTestThread::()::test_manual_locking
self = <pypy.interpreter.typedef.W_ObjectObjectUserDictWeakrefable object at 0x000001f13d476138>
def test_manual_locking(self):
import thread, os, imp, time, sys
f = open(os.path.join(self.tmpdir, 'foobaz2.py'), 'w')
f.close() # empty
done = []
def f():
sys.path.insert(0, self.tmpdir)
import foobaz2
p = sys.path.pop(0)
assert p == self.tmpdir
done.append(1)
assert not imp.lock_held()
imp.acquire_lock()
assert imp.lock_held()
thread.start_new_thread(f, ())
time.sleep(0.9)
assert not done
assert imp.lock_held()
# check that it's a recursive lock
imp.acquire_lock()
assert imp.lock_held()
imp.acquire_lock()
assert imp.lock_held()
imp.release_lock()
assert imp.lock_held()
imp.release_lock()
assert imp.lock_held()
imp.release_lock()
> assert not imp.lock_held()
E (application-level) AssertionError: assert not True
E + where True = <built-in function lock_held>()
E + where <built-in function lock_held> = <built-in function lock_held>
E + where <built-in function lock_held> = <module 'imp' (built-in)>.lock_held
[d:\pypy_stuff\buildbot64\slave\own-win-x86-64\build\pypy\module\thread\test\test_import_lock.py:33]:29: AssertionError
builder: own-win-x86-64 build #2351+
test: pypy/module/thread/test/test_import_lock.py::AppTestThread::()::test_manual_locking