diff options
| author | 2025-01-28 19:12:16 -0500 | |
|---|---|---|
| committer | 2025-01-28 19:12:16 -0500 | |
| commit | 5a7d8217a6edc66e3cf25ca0eee6614a10fa866c (patch) | |
| tree | a941825bf5fcf706f23b49e536edb9a2b26d5b6c /scripts/run_tests.py | |
| parent | e8f1b0d968a07cba884462e10718628394d1bae5 (diff) | |
| parent | a26df18796ff4e506b16bf32fcec9336233b9e2e (diff) | |
Update upstream source from tag 'upstream/1.28.5'
Update to upstream version '1.28.5'
with Debian dir a2e4b8ba663c03c37256ad2b059b382999e473bc
Diffstat (limited to 'scripts/run_tests.py')
| -rwxr-xr-x | scripts/run_tests.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/scripts/run_tests.py b/scripts/run_tests.py new file mode 100755 index 0000000..d1fd1f1 --- /dev/null +++ b/scripts/run_tests.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2021 Mike Fährmann +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. + +import os +import sys +import unittest + +TEST_DIRECTORY = os.path.join( + os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "test") + +sys.path.insert(0, TEST_DIRECTORY) + +if len(sys.argv) <= 1: + TESTS = [ + file.rpartition(".")[0] + for file in os.listdir(TEST_DIRECTORY) + if file.startswith("test_") and file != "test_results.py" + ] +else: + TESTS = [ + name if name.startswith("test_") else "test_" + name + for name in sys.argv[1:] + ] + + +suite = unittest.TestSuite() + +for test in TESTS: + try: + module = __import__(test) + except ImportError: + print("unable to import", test) + else: + tests = unittest.defaultTestLoader.loadTestsFromModule(module) + suite.addTests(tests) + +if __name__ == "__main__": + result = unittest.TextTestRunner(verbosity=2).run(suite) + if result.errors or result.failures: + sys.exit(1) |
