2003-02-12 19:02:21 -04:00
|
|
|
|
|
|
|
import imp
|
|
|
|
import unittest
|
2003-02-17 10:51:41 -04:00
|
|
|
from test_support import TestFailed, run_unittest
|
2003-02-12 19:02:21 -04:00
|
|
|
|
|
|
|
class ImpLock(unittest.TestCase):
|
|
|
|
|
|
|
|
# XXX this test is woefully inadequate, please fix me
|
|
|
|
def testLock(self):
|
|
|
|
LOOPS = 50
|
|
|
|
for i in range(LOOPS):
|
|
|
|
imp.acquire_lock()
|
|
|
|
for i in range(LOOPS):
|
|
|
|
imp.release_lock()
|
|
|
|
|
|
|
|
for i in range(LOOPS):
|
|
|
|
try:
|
|
|
|
imp.release_lock()
|
|
|
|
except RuntimeError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
raise TestFailed, \
|
|
|
|
"release_lock() without lock should raise RuntimeError"
|
|
|
|
|
2003-02-17 10:51:41 -04:00
|
|
|
def test_main():
|
|
|
|
run_unittest(ImpLock)
|
|
|
|
|
2003-02-12 19:02:21 -04:00
|
|
|
if __name__ == "__main__":
|
2003-02-17 10:51:41 -04:00
|
|
|
test_main()
|