nose2.util¶
-
nose2.util.
format_traceback
(test, err)[source]¶ Converts a
sys.exc_info()
-style tuple of values into a string.
-
nose2.util.
ln
(label, char='-', width=70)[source]¶ Draw a divider, with
label
in the middle.>>> ln('hello there') '---------------------------- hello there -----------------------------'
width
and dividerchar
may be specified. Defaults are70
and'-'
, respectively.
-
nose2.util.
name_from_path
(path)[source]¶ Translate
path
into module nameReturns a two-element tuple:
- a dotted module name that can be used in an import statement
(e.g.,
pkg1.test.test_things
) - a full path to filesystem directory, which must be on
sys.path
for the import to succeed.
- a dotted module name that can be used in an import statement
(e.g.,
-
nose2.util.
transplant_class
(cls, module)[source]¶ Make
cls
appear to reside inmodule
.Parameters: - cls – A class
- module – A module name
Returns: A subclass of
cls
that appears to have been defined inmodule
.The returned class’s
__name__
will be equal tocls.__name__
, and its__module__
equal tomodule
.