nose: nose.importer

Implements an importer that looks only in specific path (ignoring sys.path), and uses a per-path cache in addition to sys.modules. This is necessary because test modules in different directories frequently have the same names, which means that the first loaded would mask the rest when using the builtin importer.

Classes

Highlighted methods are defined in this class.

Importer (object)

An importer class that does only path-specific imports. That is, the given module is not searched for on sys.path, but only at the path or in the directory specified.

Methods

__init__(self, config=None)
importFromDir(self, dir, fqname)

Import a module only from path, ignoring sys.path and reloading if the version in sys.modules is not the one we want.

importFromPath(self, path, fqname)

Import a dotted-name package whose tail is at path. In other words, given foo.bar and path/to/foo/bar.py, import foo from path/to/foo then bar from path/to/foo/bar, returning bar.

sameModule(self, mod, filename)

Functions

add_path(path, config=None)

Ensure that the path, or the root of the current package (if path is in a package) is in sys.path.

remove_path(path)

Attributes

log
Default value: <logging.Logger instance>