Back to index

python3.2  3.2.2
Public Member Functions
importlib.test.source.test_abc_loader.MissingPathsTests Class Reference

List of all members.

Public Member Functions

def test_source_path_None
def test_all_paths_None
def test_source_path_ImportError
def test_bytecode_path_ImportError

Detailed Description

Test what happens when a source or bytecode path does not exist (either
from *_path returning None or raising ImportError).

Definition at line 495 of file test_abc_loader.py.


Member Function Documentation

Definition at line 513 of file test_abc_loader.py.

00513 
00514     def test_all_paths_None(self):
00515         # If all *_path methods return None, raise ImportError.
00516         name = 'mod'
00517         mock = PyPycLoaderMock({name: None})
00518         with util.uncache(name), self.assertRaises(ImportError):
00519             mock.load_module(name)

Here is the call graph for this function:

Definition at line 528 of file test_abc_loader.py.

00528 
00529     def test_bytecode_path_ImportError(self):
00530         # An ImportError from bytecode_path should trigger an ImportError.
00531         name = 'mod'
00532         mock = PyPycLoaderMock({name: os.path.join('path', 'to', 'mod')})
00533         bad_meth = types.MethodType(raise_ImportError, mock)
00534         mock.bytecode_path = bad_meth
00535         with util.uncache(name), self.assertRaises(ImportError):
00536             mock.load_module(name)
00537 

Here is the call graph for this function:

Definition at line 520 of file test_abc_loader.py.

00520 
00521     def test_source_path_ImportError(self):
00522         # An ImportError from source_path should trigger an ImportError.
00523         name = 'mod'
00524         mock = PyPycLoaderMock({}, {name: {'path': os.path.join('path', 'to',
00525                                                                 'mod')}})
00526         with util.uncache(name), self.assertRaises(ImportError):
00527             mock.load_module(name)

Here is the call graph for this function:

Definition at line 500 of file test_abc_loader.py.

00500 
00501     def test_source_path_None(self):
00502         # Bytecode should be used when source_path returns None, along with
00503         # __file__ being set to the bytecode path.
00504         name = 'mod'
00505         bytecode_path = 'path/to/mod'
00506         mock = PyPycLoaderMock({name: None}, {name: {'path': bytecode_path}})
00507         with util.uncache(name):
00508             module = mock.load_module(name)
00509         self.assertEqual(module.__file__, bytecode_path)

Here is the call graph for this function:


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