Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_importhooks.ImportBlocker Class Reference

List of all members.

Public Member Functions

def __init__
def find_module
def load_module

Public Attributes


Detailed Description

Place an ImportBlocker instance on sys.meta_path and you
can be sure the modules you specified can't be imported, even
if it's a builtin.

Definition at line 88 of file

Constructor & Destructor Documentation

def test.test_importhooks.ImportBlocker.__init__ (   self,

Definition at line 92 of file

00093     def __init__(self, *namestoblock):
        self.namestoblock = dict.fromkeys(namestoblock)

Here is the caller graph for this function:

Member Function Documentation

def test.test_importhooks.ImportBlocker.find_module (   self,
  path = None 

Definition at line 94 of file

00095     def find_module(self, fullname, path=None):
00096         if fullname in self.namestoblock:
00097             return self
        return None
def test.test_importhooks.ImportBlocker.load_module (   self,

Definition at line 98 of file

00099     def load_module(self, fullname):
00100         raise ImportError("I dare you")

Member Data Documentation

Definition at line 93 of file

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