X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dunshire.git;a=blobdiff_plain;f=test%2F__main__.py;h=aca4e64ec83a4f944e57ec67117c6d2de74db0db;hp=b0598e7dbbff4fa082039b4c41bff1604e8c2506;hb=d08e0af9bf86e81d4a5b3dbbe38092bacc5edd62;hpb=6b28e89a792679e30249f5c187feefa2bdfa18a6 diff --git a/test/__main__.py b/test/__main__.py index b0598e7..aca4e64 100755 --- a/test/__main__.py +++ b/test/__main__.py @@ -2,9 +2,33 @@ """ An implementation of __main__() that allows us to "run this module." """ +from sys import argv + from test import build_suite, run_suite -if run_suite(build_suite()).wasSuccessful(): +# 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 + +# 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: + while(result.wasSuccessful()): + result = run_suite(build_suite(doctests)) + +exit(1)