Back to index

python3.2  3.2.2
Public Member Functions
importlib.test.import_.test_packages.ParentModuleTests Class Reference

List of all members.

Public Member Functions

def test_import_parent
def test_bad_parent
def test_module_not_package

Detailed Description

Importing a submodule should import the parent modules.

Definition at line 8 of file

Member Function Documentation

Definition at line 18 of file

00019     def test_bad_parent(self):
00020         with util.mock_modules('pkg.module') as mock:
00021             with util.import_state(meta_path=[mock]):
00022                 with self.assertRaises(ImportError):
00023                     import_util.import_('pkg.module')

Here is the call graph for this function:

Definition at line 12 of file

00013     def test_import_parent(self):
00014         with util.mock_modules('pkg.__init__', 'pkg.module') as mock:
00015             with util.import_state(meta_path=[mock]):
00016                 module = import_util.import_('pkg.module')
00017                 self.assertTrue('pkg' in sys.modules)

Here is the call graph for this function:

Definition at line 24 of file

00025     def test_module_not_package(self):
00026         # Try to import a submodule from a non-package should raise ImportError.
00027         assert not hasattr(sys, '__path__')
00028         with self.assertRaises(ImportError):
00029             import_util.import_('sys.no_submodules_here')

Here is the call graph for this function:

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