From: Philippe Proulx Date: Mon, 18 Dec 2017 23:29:40 +0000 (-0500) Subject: tests/utils/python/testrunner.py: add optional pattern argument X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=b83084f5ca5b6175425c3b7f6977e9d8f6d9d04a;p=babeltrace.git tests/utils/python/testrunner.py: add optional pattern argument Add an optional command-line argument (second) to `testrunner.py`: the test file name pattern. You can use this argument to run only specific files in a given test directory, instead of the default which is `test*.py`. Signed-off-by: Philippe Proulx --- diff --git a/tests/utils/python/testrunner.py b/tests/utils/python/testrunner.py index ef1872fa..175c8fd1 100644 --- a/tests/utils/python/testrunner.py +++ b/tests/utils/python/testrunner.py @@ -27,7 +27,13 @@ import sys if __name__ == '__main__': loader = unittest.TestLoader() - tests = loader.discover(sys.argv[1]) + + if len(sys.argv) >= 3: + pattern = sys.argv[2] + else: + pattern = 'test*.py' + + tests = loader.discover(sys.argv[1], pattern) runner = TAPTestRunner() runner.set_stream(True) runner.set_format('{method_name}')