Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_threaded_import.Finder Class Reference

List of all members.

Public Member Functions

def __init__
def find_module

Public Attributes

 numcalls
 x
 lock

Detailed Description

A dummy finder to detect concurrent access to its find_module()
method.

Definition at line 58 of file test_threaded_import.py.


Constructor & Destructor Documentation

Definition at line 62 of file test_threaded_import.py.

00062 
00063     def __init__(self):
00064         self.numcalls = 0
00065         self.x = 0
00066         self.lock = thread.allocate_lock()

Here is the caller graph for this function:


Member Function Documentation

def test.test_threaded_import.Finder.find_module (   self,
  name,
  path = None 
)

Definition at line 67 of file test_threaded_import.py.

00067 
00068     def find_module(self, name, path=None):
00069         # Simulate some thread-unsafe behaviour. If calls to find_module()
00070         # are properly serialized, `x` will end up the same as `numcalls`.
00071         # Otherwise not.
00072         with self.lock:
00073             self.numcalls += 1
00074         x = self.x
00075         time.sleep(0.1)
00076         self.x = x + 1


Member Data Documentation

Definition at line 65 of file test_threaded_import.py.

Definition at line 63 of file test_threaded_import.py.

Definition at line 64 of file test_threaded_import.py.


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