This commit adds a "check-verbose" target that runs the test suite,
outputting the name and result of each test as it goes. This mimics
what "python setup.py test" does, but that command is apparently
deprecated; so now the usual test entry point can do it too.
check:
PYTHONPATH="." test/__main__.py
check:
PYTHONPATH="." test/__main__.py
+# Run the test suite once, loudly. This is used in Gentoo, for example
+# where we want users to see the output from the test suite on the off
+# chance that it fails and they have to report it.
+.PHONY: check-verbose
+check-verbose:
+ PYTHONPATH="." test/__main__.py --verbose
+
# Run the test suite forever, but only the parts of it that are
# randomized.
.PHONY: checkloop
# Run the test suite forever, but only the parts of it that are
# randomized.
.PHONY: checkloop
suite.addTest(mat_tests)
return suite
suite.addTest(mat_tests)
return suite
+def run_suite(suite, verbosity):
"""
Run all of the unit and doctests for the :mod:`dunshire` and
:mod:`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)
from test import build_suite, run_suite
from test import build_suite, run_suite
-def main(doctests, loop):
+def main(doctests, loop, verbose):
"""
The main function for this module. It runs the tests.
"""
The main function for this module. It runs the tests.
loop : bool
Do you want to loop and rerun the tests indefinitely?
loop : bool
Do you want to loop and rerun the tests indefinitely?
+ verbose : bool
+ Do you want to see the name and result of each test as
+ it is run?
+
"""
# Running the test suite clobbers it! And deepcopy() doesn't work
# on a suite that contains doctests! ARRRGRRGRRGRHG!!!!!! You're all
# idiots.
"""
# Running the test suite clobbers it! And deepcopy() doesn't work
# on a suite that contains doctests! ARRRGRRGRRGRHG!!!!!! You're all
# idiots.
- result = run_suite(build_suite(doctests))
+ verbosity = 1
+ if verbose: verbosity = 2
+ result = run_suite(build_suite(doctests), verbosity)
if result.wasSuccessful() and not loop:
return 0
if result.wasSuccessful() and not loop:
return 0
while result.wasSuccessful():
print('Passed: {:d}'.format(passed))
passed += 1
while result.wasSuccessful():
print('Passed: {:d}'.format(passed))
passed += 1
- result = run_suite(build_suite(doctests))
+ result = run_suite(build_suite(doctests), verbosity)
return 1
if __name__ == '__main__':
return 1
if __name__ == '__main__':
- exit(main(not "--no-doctests" in argv, '--loop' in argv))
+ doctests = not "--no-doctests" in argv
+ loop = '--loop' in argv
+ verbose = '--verbose' in argv
+ exit(main(doctests, loop, verbose))