X-Git-Url: https://gitweb.michael.orlitzky.com/?p=dunshire.git;a=blobdiff_plain;f=test%2F__main__.py;h=c8f0f24369debd78bf06b0e4c16f441e16858b67;hp=d4ef145caa663c78d6d4e1891b031b61d56d152b;hb=4a9928501f79549742c2e335742ddc65040f744f;hpb=ff9a508f946f02c9c8896ebadccf2a44525a52a9 diff --git a/test/__main__.py b/test/__main__.py index d4ef145..c8f0f24 100755 --- a/test/__main__.py +++ b/test/__main__.py @@ -7,7 +7,7 @@ from sys import argv 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. @@ -26,11 +26,17 @@ def main(doctests, loop): 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. - 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 @@ -40,10 +46,13 @@ def main(doctests, loop): 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__': - 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))