Back to index

python3.2  3.2.2
Public Member Functions
importlib.test.import_.test_meta_path.CallingOrder Class Reference

List of all members.

Public Member Functions

def test_first_called
def test_continuing

Detailed Description

Calls to the importers on sys.meta_path happen in order that they are
specified in the sequence, starting with the first importer
[first called], and then continuing on down until one is found that doesn't
return None [continuing].

Definition at line 7 of file test_meta_path.py.


Member Function Documentation

Definition at line 26 of file test_meta_path.py.

00026 
00027     def test_continuing(self):
00028         # [continuing]
00029         mod_name = 'for_real'
00030         with util.mock_modules('nonexistent') as first, \
00031              util.mock_modules(mod_name) as second:
00032             first.find_module = lambda self, fullname, path=None: None
00033             second.modules[mod_name] = 42
00034             with util.import_state(meta_path=[first, second]):
00035                 self.assertEqual(import_util.import_(mod_name), 42)
00036 

Here is the call graph for this function:

Definition at line 15 of file test_meta_path.py.

00015 
00016     def test_first_called(self):
00017         # [first called]
00018         mod = 'top_level'
00019         first = util.mock_modules(mod)
00020         second = util.mock_modules(mod)
00021         with util.mock_modules(mod) as first, util.mock_modules(mod) as second:
00022             first.modules[mod] = 42
00023             second.modules[mod] = -13
00024             with util.import_state(meta_path=[first, second]):
00025                 self.assertEqual(import_util.import_(mod), 42)

Here is the call graph for this function:


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