The whole test suite.
This module compiles the doctests and unittests from the rest of the
-codebase into one big TestSuite() and the runs it.
+codebase into one big TestSuite() and the runs it. It also provides a
+function :func:`build_suite` that merely builds the suite; the result
+can be used by setuptools.
"""
from unittest import TestLoader, TestSuite, TextTestRunner
from dunshire import games
from test import symmetric_linear_game_test
-def run_suite():
+def build_suite():
"""
- Run all of the unit and doctests for the ``dunshire`` and ``test``
- packages.
+ Build our test suite, separately from running it.
"""
suite = TestSuite()
suite.addTest(DocTestSuite(cones))
suite.addTest(DocTestSuite(symmetric_linear_game_test))
slg_tests = TestLoader().loadTestsFromModule(symmetric_linear_game_test)
suite.addTest(slg_tests)
- runner = TextTestRunner(verbosity=1)
- runner.run(suite)
+ return suite
-if __name__ == '__main__':
- run_suite()
+def run_suite(s):
+ """
+ Run all of the unit and doctests for the ``dunshire`` and ``test``
+ packages.
+ """
+ runner = TextTestRunner(verbosity=1)
+ runner.run(s)