API Reference for Enthought Tool Suite 3.0.1
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.
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 enthought.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
| Local name | Refers to |
|---|---|
| doctest | doctest |
| unittest | unittest |
© Copyright 2002-2008 Enthought, Inc.