]>
gitweb.michael.orlitzky.com - dunshire.git/blob - __main__.py
d4ef145caa663c78d6d4e1891b031b61d56d152b
3 An implementation of __main__() that allows us to "run this module."
7 from test
import build_suite
, run_suite
10 def main(doctests
, loop
):
12 The main function for this module. It runs the tests.
14 We take two command-line arguments. The first enables you to turn
15 off the doctests, which are deterministic. The second tells us to
16 repeat the test suite indefinitely rather than return the result of
17 running it once. The flags usually occur together so that we don't
18 waste time running the doctests in a loop.
24 Do you want to run the doctests?
27 Do you want to loop and rerun the tests indefinitely?
30 # Running the test suite clobbers it! And deepcopy() doesn't work
31 # on a suite that contains doctests! ARRRGRRGRRGRHG!!!!!! You're all
33 result
= run_suite(build_suite(doctests
))
35 if result
.wasSuccessful() and not loop
:
40 while result
.wasSuccessful():
41 print('Passed: {:d}'.format(passed
))
43 result
= run_suite(build_suite(doctests
))
48 if __name__
== '__main__':
49 exit(main(not "--no-doctests" in argv
, '--loop' in argv
))