Back to index

python3.2  3.2.2
Public Member Functions
test.test_imp.LockTests Class Reference

List of all members.

Public Member Functions

def verify_lock_state
def testLock

Detailed Description

Very basic test of import lock functions.

Definition at line 10 of file test_imp.py.


Member Function Documentation

Definition at line 17 of file test_imp.py.

00017 
00018     def testLock(self):
00019         LOOPS = 50
00020 
00021         # The import lock may already be held, e.g. if the test suite is run
00022         # via "import test.autotest".
00023         lock_held_at_start = imp.lock_held()
00024         self.verify_lock_state(lock_held_at_start)
00025 
00026         for i in range(LOOPS):
00027             imp.acquire_lock()
00028             self.verify_lock_state(True)
00029 
00030         for i in range(LOOPS):
00031             imp.release_lock()
00032 
00033         # The original state should be restored now.
00034         self.verify_lock_state(lock_held_at_start)
00035 
00036         if not lock_held_at_start:
00037             try:
00038                 imp.release_lock()
00039             except RuntimeError:
00040                 pass
00041             else:
00042                 self.fail("release_lock() without lock should raise "
00043                             "RuntimeError")

Here is the call graph for this function:

def test.test_imp.LockTests.verify_lock_state (   self,
  expected 
)

Definition at line 14 of file test_imp.py.

00014 
00015     def verify_lock_state(self, expected):
00016         self.assertEqual(imp.lock_held(), expected,
                             "expected imp.lock_held() to be %r" % expected)

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: