Back to index

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

List of all members.

Public Member Functions

def __init__
def __enter__
def __exit__

Public Attributes

 exc
 attrs
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Detailed Description

Raise ResourceDenied if an exception is raised while the context manager
is in effect that matches the specified exception and attributes.

Definition at line 834 of file support.py.


Constructor & Destructor Documentation

def test.support.TransientResource.__init__ (   self,
  exc,
  kwargs 
)

Definition at line 839 of file support.py.

00839 
00840     def __init__(self, exc, **kwargs):
00841         self.exc = exc
00842         self.attrs = kwargs

Here is the caller graph for this function:


Member Function Documentation

Definition at line 843 of file support.py.

00843 
00844     def __enter__(self):
00845         return self

def test.support.TransientResource.__exit__ (   self,
  type_ = None,
  value = None,
  traceback = None 
)
If type_ is a subclass of self.exc and value has attributes matching
self.attrs, raise ResourceDenied.  Otherwise let the exception
propagate (if any).

Definition at line 846 of file support.py.

00846 
00847     def __exit__(self, type_=None, value=None, traceback=None):
00848         """If type_ is a subclass of self.exc and value has attributes matching
00849         self.attrs, raise ResourceDenied.  Otherwise let the exception
00850         propagate (if any)."""
00851         if type_ is not None and issubclass(self.exc, type_):
00852             for attr, attr_value in self.attrs.items():
00853                 if not hasattr(value, attr):
00854                     break
00855                 if getattr(value, attr) != attr_value:
00856                     break
00857             else:
00858                 raise ResourceDenied("an optional resource is not available")
00859 
00860 # Context managers that raise ResourceDenied when various issues
00861 # with the Internet connection manifest themselves as exceptions.
# XXX deprecate these and use transient_internet() instead

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 841 of file support.py.

Definition at line 840 of file support.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: