X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2F__init__.py;fp=test%2F__init__.py;h=6942bf2f2af83c8749bae65c586f685ec5b95e08;hb=bdb596b84a06d0c97e39d42586a51fc36ba44186;hp=0000000000000000000000000000000000000000;hpb=21a2eb9a647a48c0e94d02c60ef8785c4ea35f7b;p=dunshire.git diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..6942bf2 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,39 @@ +""" +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. 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 doctest import DocTestSuite + +from dunshire import cones +from dunshire import errors +from dunshire import matrices +from dunshire import games +from test import symmetric_linear_game_test + +def build_suite(): + """ + Build our test suite, separately from running it. + """ + suite = TestSuite() + suite.addTest(DocTestSuite(cones)) + suite.addTest(DocTestSuite(errors)) + suite.addTest(DocTestSuite(matrices)) + suite.addTest(DocTestSuite(games)) + suite.addTest(DocTestSuite(symmetric_linear_game_test)) + slg_tests = TestLoader().loadTestsFromModule(symmetric_linear_game_test) + suite.addTest(slg_tests) + return 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)