test_tools
Public Member Functions | Public Attributes | List of all members
test_tools.doctest_unittest._TestDocTests Class Reference
Inheritance diagram for test_tools.doctest_unittest._TestDocTests:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, str pkg_name, str module_name=None, str method_name="test_doctests")
 
def test_doctests (self)
 

Public Attributes

 module_name
 
 pkg_name
 

Detailed Description

Parent class, which runs all doctests in a python module. As rospkg is used to locate the module, this test only
can be applied to catkin packages.
To create your own test:
from test_tools.doctest_unittest import _TestDocTests

class DocTestsModuleA(_TestDocTests):
    def __init__(self, method_name="test_doctests"):
    super(DocTestsModuleA, self).__init__(pkg_name="ModuleA", method_name=method_name)

if __name__ == '__main__':
    suite = unittest.TestSuite()
    suite.addTest(DocTestsModuleA())
    unittest.TextTestRunner(verbosity=2).run(suite)

Definition at line 10 of file doctest_unittest.py.

Constructor & Destructor Documentation

◆ __init__()

def test_tools.doctest_unittest._TestDocTests.__init__ (   self,
str  pkg_name,
str   module_name = None,
str   method_name = "test_doctests" 
)
Constructor

:param pkg_name: Name of catkin package
:param module_name: Name of the python module
:param method_name: Name of the member variable to run, this should be "test_doctests" and shouldn't
    be changed.

Definition at line 28 of file doctest_unittest.py.

Member Function Documentation

◆ test_doctests()

def test_tools.doctest_unittest._TestDocTests.test_doctests (   self)
Iterates over all Python files in module_name/src/module_name and runs doctest.testmod

Definition at line 45 of file doctest_unittest.py.

Member Data Documentation

◆ module_name

test_tools.doctest_unittest._TestDocTests.module_name

Definition at line 43 of file doctest_unittest.py.

◆ pkg_name

test_tools.doctest_unittest._TestDocTests.pkg_name

Definition at line 42 of file doctest_unittest.py.


The documentation for this class was generated from the following file: