]>
gitweb.michael.orlitzky.com - dunshire.git/blob - test/__main__.py
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
, verbose
):
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 Do you want to see the name and result of each test as
34 # Running the test suite clobbers it! And deepcopy() doesn't work
35 # on a suite that contains doctests! ARRRGRRGRRGRHG!!!!!! You're all
38 if verbose
: verbosity
= 2
39 result
= run_suite(build_suite(doctests
), verbosity
)
41 if result
.wasSuccessful() and not loop
:
46 while result
.wasSuccessful():
47 print('Passed: {:d}'.format(passed
))
49 result
= run_suite(build_suite(doctests
), verbosity
)
54 if __name__
== '__main__':
55 doctests
= not "--no-doctests" in argv
56 loop
= '--loop' in argv
57 verbose
= '--verbose' in argv
58 exit(main(doctests
, loop
, verbose
))