Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.support.DirsOnSysPath Class Reference
Inheritance diagram for test.support.DirsOnSysPath:
Inheritance graph
[legend]
Collaboration diagram for test.support.DirsOnSysPath:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __enter__
def __exit__

Public Attributes

 original_value
 original_object
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Context manager to temporarily add directories to sys.path.

This makes a copy of sys.path, appends any directories given
as positional arguments, then reverts sys.path to the copied
settings when the context ends.

Note that *all* sys.path modifications in the body of the
context manager, including replacement of the object,
will be reverted at the end of the block.

Definition at line 809 of file support.py.


Constructor & Destructor Documentation

def test.support.DirsOnSysPath.__init__ (   self,
  paths 
)

Definition at line 821 of file support.py.

00821 
00822     def __init__(self, *paths):
00823         self.original_value = sys.path[:]
00824         self.original_object = sys.path
00825         sys.path.extend(paths)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 826 of file support.py.

00826 
00827     def __enter__(self):
00828         return self

def test.support.DirsOnSysPath.__exit__ (   self,
  ignore_exc 
)

Definition at line 829 of file support.py.

00829 
00830     def __exit__(self, *ignore_exc):
00831         sys.path = self.original_object
00832         sys.path[:] = self.original_value
00833 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Definition at line 823 of file support.py.

Definition at line 822 of file support.py.


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