]> gitweb.michael.orlitzky.com - dunshire.git/blobdiff - test/__init__.py
test: add the ability to run the test suite verbosely.
[dunshire.git] / test / __init__.py
index 0f6f15c665da78f61effd04e9159e5bf50b9ef56..28d90a6c56098a93e02efabc04ffa7185400c2bf 100644 (file)
@@ -18,27 +18,36 @@ from test import matrices_test
 from test import randomgen
 from test import symmetric_linear_game_test
 
-def build_suite():
+def build_suite(doctests=True):
     """
     Build our test suite, separately from running it.
+
+    Parameters
+    ----------
+
+    doctests : bool
+        Do you want to build the doctests, too? During random testing,
+        the answer may be "no."
+
     """
     suite = TestSuite()
-    suite.addTest(DocTestSuite(cones))
-    suite.addTest(DocTestSuite(errors, optionflags=ELLIPSIS))
-    suite.addTest(DocTestSuite(games, optionflags=ELLIPSIS))
-    suite.addTest(DocTestSuite(matrices, optionflags=ELLIPSIS))
-    suite.addTest(DocTestSuite(symmetric_linear_game_test))
-    suite.addTest(DocTestSuite(randomgen, optionflags=ELLIPSIS))
+    if doctests:
+        suite.addTest(DocTestSuite(cones))
+        suite.addTest(DocTestSuite(errors, optionflags=ELLIPSIS))
+        suite.addTest(DocTestSuite(games, optionflags=ELLIPSIS))
+        suite.addTest(DocTestSuite(matrices, optionflags=ELLIPSIS))
+        suite.addTest(DocTestSuite(symmetric_linear_game_test))
+        suite.addTest(DocTestSuite(randomgen, optionflags=ELLIPSIS))
     slg_tests = TestLoader().loadTestsFromModule(symmetric_linear_game_test)
     suite.addTest(slg_tests)
     mat_tests = TestLoader().loadTestsFromModule(matrices_test)
     suite.addTest(mat_tests)
     return suite
 
-def run_suite(suite):
+def run_suite(suite, verbosity):
     """
-    Run all of the unit and doctests for the ``dunshire`` and ``test``
-    packages.
+    Run all of the unit and doctests for the :mod:`dunshire` and
+    :mod:`test` packages.
     """
-    runner = TextTestRunner(verbosity=1)
+    runner = TextTestRunner(verbosity=verbosity)
     return runner.run(suite)