X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=test%2F__main__.py;h=d03b7a6968504f2b941cb4dd223a13676565e32b;hb=ec229377a0e8f15b6209b69cf7f983cdbabb1f9f;hp=8d88f647376f1d555691c1119b0216399e3c8a29;hpb=903bd9bee55bcc404ae39a94d2625814d5bcc2a3;p=dunshire.git diff --git a/test/__main__.py b/test/__main__.py index 8d88f64..d03b7a6 100755 --- a/test/__main__.py +++ b/test/__main__.py @@ -2,11 +2,36 @@ """ An implementation of __main__() that allows us to "run this module." """ +from sys import argv + from test import build_suite, run_suite -result = run_suite(build_suite()) +# We take two command-line arguments. The first enables you to turn +# off the doctests, which are deterministic. The second tells us to +# repeat the test suite indefinitely rather than return the result +# of running it once. The flags usually occur together so that we +# don't waste time running the doctests in a loop. +doctests = True +loop = False + +if "--no-doctests" in argv: + doctests = False + +if "--loop" in argv: + loop = True -if result.wasSuccessful(): +# 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)) + +if result.wasSuccessful() and not loop: exit(0) -else: - exit(1) + +if loop: + passed = 0 + while(result.wasSuccessful()): + print('Passed: {:d}'.format(passed)) + passed += 1 + result = run_suite(build_suite(doctests)) + +exit(1)