mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	 996acf122d
			
		
	
	
		996acf122d
		
	
	
	
	
		
			
			There was no test_main() and the main body was protected by if __name__ == '__main__' so the test didn't happen on import either.
		
			
				
	
	
		
			29 lines
		
	
	
	
		
			695 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
	
		
			695 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| 
 | |
| import imp
 | |
| import unittest
 | |
| from test_support import TestFailed, run_unittest
 | |
| 
 | |
| 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"
 | |
| 
 | |
| def test_main():
 | |
|     run_unittest(ImpLock)
 | |
| 
 | |
| if __name__ == "__main__":
 | |
|     test_main()
 |