blob: 22e25ba5ec57f928ee3eaff3c667b0e5580064f4 [file] [log] [blame]
Neal Norwitz2294c0d2003-02-12 23:02:21 +00001
2import imp
3import unittest
Neal Norwitz3b8fb472003-02-17 22:38:56 +00004from test.test_support import TestFailed, run_unittest
Neal Norwitz2294c0d2003-02-12 23:02:21 +00005
6class ImpLock(unittest.TestCase):
7
8 # XXX this test is woefully inadequate, please fix me
9 def testLock(self):
10 LOOPS = 50
11 for i in range(LOOPS):
12 imp.acquire_lock()
13 for i in range(LOOPS):
14 imp.release_lock()
15
16 for i in range(LOOPS):
17 try:
18 imp.release_lock()
19 except RuntimeError:
20 pass
21 else:
22 raise TestFailed, \
23 "release_lock() without lock should raise RuntimeError"
24
Neal Norwitz996acf12003-02-17 14:51:41 +000025def test_main():
26 run_unittest(ImpLock)
27
Neal Norwitz2294c0d2003-02-12 23:02:21 +000028if __name__ == "__main__":
Neal Norwitz996acf12003-02-17 14:51:41 +000029 test_main()