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
labelin the middle.>>> ln('hello there') '---------------------------- hello there -----------------------------'
widthand dividercharmay be specified. Defaults are70and'-', respectively.
-
nose2.util.name_from_path(path)[source]¶ Translate
pathinto 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.pathfor 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
clsappear to reside inmodule.Parameters: - cls – A class
- module – A module name
Returns: A subclass of
clsthat appears to have been defined inmodule.The returned class’s
__name__will be equal tocls.__name__, and its__module__equal tomodule.