Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
test.test_multiprocessing._TestFinalize Class Reference
Inheritance diagram for test.test_multiprocessing._TestFinalize:
Inheritance graph
[legend]
Collaboration diagram for test.test_multiprocessing._TestFinalize:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def test_finalize
def assertTimingAlmostEqual
def assertReturnsIfImplemented
def __reduce__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

tuple ALLOWED_TYPES = ('processes',)

Private Member Functions

def _test_finalize

Detailed Description

Definition at line 1779 of file test_multiprocessing.py.


Member Function Documentation

def test.test_multiprocessing.BaseTestCase.__reduce__ (   self,
  args 
) [inherited]

Definition at line 124 of file test_multiprocessing.py.

00124 
00125     def __reduce__(self, *args):
00126         raise NotImplementedError("shouldn't try to pickle a test case")

def test.test_multiprocessing._TestFinalize._test_finalize (   cls,
  conn 
) [private]

Definition at line 1784 of file test_multiprocessing.py.

01784 
01785     def _test_finalize(cls, conn):
01786         class Foo(object):
01787             pass
01788 
01789         a = Foo()
01790         util.Finalize(a, conn.send, args=('a',))
01791         del a           # triggers callback for a
01792 
01793         b = Foo()
01794         close_b = util.Finalize(b, conn.send, args=('b',))
01795         close_b()       # triggers callback for b
01796         close_b()       # does nothing because callback has already been called
01797         del b           # does nothing because callback has already been called
01798 
01799         c = Foo()
01800         util.Finalize(c, conn.send, args=('c',))
01801 
01802         d10 = Foo()
01803         util.Finalize(d10, conn.send, args=('d10',), exitpriority=1)
01804 
01805         d01 = Foo()
01806         util.Finalize(d01, conn.send, args=('d01',), exitpriority=0)
01807         d02 = Foo()
01808         util.Finalize(d02, conn.send, args=('d02',), exitpriority=0)
01809         d03 = Foo()
01810         util.Finalize(d03, conn.send, args=('d03',), exitpriority=0)
01811 
01812         util.Finalize(None, conn.send, args=('e',), exitpriority=-10)
01813 
01814         util.Finalize(None, conn.send, args=('STOP',), exitpriority=-100)
01815 
01816         # call multiprocessing's cleanup function then exit process without
01817         # garbage collecting locals
01818         util._exit_function()
01819         conn.close()
01820         os._exit(0)

Here is the caller graph for this function:

def test.test_multiprocessing.BaseTestCase.assertReturnsIfImplemented (   self,
  value,
  func,
  args 
) [inherited]

Definition at line 114 of file test_multiprocessing.py.

00114 
00115     def assertReturnsIfImplemented(self, value, func, *args):
00116         try:
00117             res = func(*args)
00118         except NotImplementedError:
00119             pass
00120         else:
00121             return self.assertEqual(value, res)

Here is the call graph for this function:

Here is the caller graph for this function:

def test.test_multiprocessing.BaseTestCase.assertTimingAlmostEqual (   self,
  a,
  b 
) [inherited]

Definition at line 110 of file test_multiprocessing.py.

00110 
00111     def assertTimingAlmostEqual(self, a, b):
00112         if CHECK_TIMINGS:
00113             self.assertAlmostEqual(a, b, 1)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1821 of file test_multiprocessing.py.

01821 
01822     def test_finalize(self):
01823         conn, child_conn = self.Pipe()
01824 
01825         p = self.Process(target=self._test_finalize, args=(child_conn,))
01826         p.start()
01827         p.join()
01828 
01829         result = [obj for obj in iter(conn.recv, 'STOP')]
01830         self.assertEqual(result, ['a', 'b', 'd10', 'd03', 'd02', 'd01', 'e'])
01831 
01832 #
01833 # Test that from ... import * works for each module
01834 #

Here is the call graph for this function:


Member Data Documentation

Reimplemented from test.test_multiprocessing.BaseTestCase.

Definition at line 1781 of file test_multiprocessing.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


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