diff options
author | mathieui <mathieui@mathieui.net> | 2021-02-14 11:33:47 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-02-20 11:53:30 +0100 |
commit | 94700de7a3d9c499dc8ee13d969c3b36126bdc5b (patch) | |
tree | e865a1a08820b91eaf84545d0f60a1ca94e61cf5 /run_tests.py | |
parent | 2f0660c6ffc39639739fb6c0adfaa555e5780a73 (diff) | |
download | slixmpp-94700de7a3d9c499dc8ee13d969c3b36126bdc5b.tar.gz slixmpp-94700de7a3d9c499dc8ee13d969c3b36126bdc5b.tar.bz2 slixmpp-94700de7a3d9c499dc8ee13d969c3b36126bdc5b.tar.xz slixmpp-94700de7a3d9c499dc8ee13d969c3b36126bdc5b.zip |
run_tests: add a command-line option to enable debug logs
Diffstat (limited to 'run_tests.py')
-rwxr-xr-x | run_tests.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/run_tests.py b/run_tests.py index 3b9df045..f5103b15 100755 --- a/run_tests.py +++ b/run_tests.py @@ -10,7 +10,7 @@ from importlib import import_module from pathlib import Path -def run_tests(filenames=None): +def run_tests(filenames=None, debug=False): """ Find and run all tests in the tests/ directory. @@ -31,9 +31,12 @@ def run_tests(filenames=None): tests = unittest.TestSuite(suites) runner = unittest.TextTestRunner(verbosity=2) - # Disable logging output - logging.basicConfig(level=100) - logging.disable(100) + if debug: + logging.basicConfig(level='DEBUG') + else: + # Disable logging output + logging.basicConfig(level=100) + logging.disable(100) result = runner.run(tests) return result @@ -58,9 +61,10 @@ class TestCommand(Command): if __name__ == '__main__': parser = ArgumentParser(description='Run unit tests.') parser.add_argument('tests', metavar='TEST', nargs='*', help='list of tests to run, or nothing to run them all') + parser.add_argument('-d', '--debug', action='store_true', dest='debug', default=False, help='enable debug output') args = parser.parse_args() - result = run_tests(args.tests) + result = run_tests(args.tests, args.debug) print("<tests %s ran='%s' errors='%s' fails='%s' success='%s'/>" % ( "xmlns='http//andyet.net/protocol/tests'", result.testsRun, len(result.errors), |