Neal Norwitz | 2294c0d | 2003-02-12 23:02:21 +0000 | [diff] [blame] | 1 | |
| 2 | import imp |
| 3 | import unittest |
| 4 | from test_support import TestFailed |
| 5 | |
| 6 | class 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 | |
| 25 | if __name__ == "__main__": |
| 26 | test_support.run_unittest(ImpLock) |