]> gitweb.michael.orlitzky.com - dunshire.git/blobdiff - test/__init__.py
Add setup.py and reorganize everything to make its "test" command happy.
[dunshire.git] / test / __init__.py
similarity index 73%
rename from src/test/suite.py
rename to test/__init__.py
index e10c38d98a3401a2f0a37fa033f77d3e2270863a..6942bf2f2af83c8749bae65c586f685ec5b95e08 100644 (file)
@@ -2,7 +2,9 @@
 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
@@ -14,10 +16,9 @@ from dunshire import matrices
 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))
@@ -27,8 +28,12 @@ def run_suite():
     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)