diff options
author | Guido van Rossum <guido@google.com> | 2012-12-17 17:46:08 -0800 |
---|---|---|
committer | Guido van Rossum <guido@google.com> | 2012-12-17 17:46:08 -0800 |
commit | 3427a3918496ed391d47716af7945da362b1f045 (patch) | |
tree | e18286c9d5cf41a0e130940a9004ee71b9b3a3cb /runtests.py | |
parent | a85f2438b3e2c88171c6940c4147cd32b170f734 (diff) | |
download | trollius-3427a3918496ed391d47716af7945da362b1f045.tar.gz |
Checkpoint: First unittests.
Diffstat (limited to 'runtests.py')
-rw-r--r-- | runtests.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/runtests.py b/runtests.py new file mode 100644 index 0000000..fa7638a --- /dev/null +++ b/runtests.py @@ -0,0 +1,39 @@ +"""Run all unittests.""" + +# Originally written by Beech Horn (for NDB). + +import sys +import unittest + + +def load_tests(): + mods = ['futures'] + test_mods = ['%s_test' % name for name in mods] + tulip = __import__('tulip', fromlist=test_mods) + + loader = unittest.TestLoader() + suite = unittest.TestSuite() + + for mod in [getattr(tulip, name) for name in test_mods]: + for name in set(dir(mod)): + if name.endswith('Tests'): + test_module = getattr(mod, name) + tests = loader.loadTestsFromTestCase(test_module) + suite.addTests(tests) + + return suite + + +def main(): + v = 1 + for arg in sys.argv[1:]: + if arg.startswith('-v'): + v += arg.count('v') + elif arg == '-q': + v = 0 + result = unittest.TextTestRunner(verbosity=v).run(load_tests()) + sys.exit(not result.wasSuccessful()) + + +if __name__ == '__main__': + main() |