tests/utils/python/testrunner.py: add optional pattern argument
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 18 Dec 2017 23:29:40 +0000 (18:29 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 03:32:02 +0000 (23:32 -0400)
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 <eeppeliteloop@gmail.com>
tests/utils/python/testrunner.py

index ef1872fa36b3703914d00c2ed5218adda3124cd5..175c8fd188c8ba2b43dde2412fe21f7c3ae8712d 100644 (file)
@@ -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}')
This page took 0.025284 seconds and 4 git commands to generate.