testing Package

testing Package

Scripts related to running unit tests, based on testoob. Part of the ETSDevTools project of the Enthought Tool Suite.

These scripts also allow running test suites in separate processes and aggregating the results.

doctest_tools Module

Tools for having doctest and unittest work together more nicely.

Eclipse’s PyDev plugin will run your unittest files for you very nicely. The doctest_for_module function allows you to easily run the doctest for a module along side your standard unit tests within Eclipse.

traits.testing.doctest_tools.doctest_for_module(module)[source]

Create a TestCase from a module’s doctests that will be run by the standard unittest.main().

Example tests/test_foo.py:

import unittest

import foo
from traits.testing.api import doctest_for_module

class FooTestCase(unittest.TestCase):
    ...

class FooDocTest(doctest_for_module(foo)):
    pass

if __name__ == "__main__":
    # This will run and report both FooTestCase and the doctests in
    # module foo.
    unittest.main()

Alternatively, you can say:

FooDocTest = doctest_for_module(foo)

instead of:

class FooDocTest(doctest_for_module(foo)):
    pass

nose_tools Module

Non-standard functions for the ‘nose’ testing framework.

traits.testing.nose_tools.deprecated(f)[source]

Stub replacement for marking a unit test deprecated in the absence of ‘nose’.

traits.testing.nose_tools.performance(f)[source]

Decorator to add an attribute to the test to mark it as a performance-measuring test.

traits.testing.nose_tools.skip(f)[source]

Stub replacement for marking a unit test to be skipped in the absence of ‘nose’.

Table Of Contents

Previous topic

protocols Package

Next topic

util Package

This Page