Alembic unittest: pass unknown CLI arguments to unittest.main()
authorSybren A. Stüvel <sybren@stuvel.eu>
Tue, 18 Apr 2017 10:20:41 +0000 (12:20 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Tue, 18 Apr 2017 11:57:04 +0000 (13:57 +0200)
This allows specifying test names on the CLI, in order to run only one
of the tests.

tests/python/alembic_tests.py

index 14c817549a9ae27b0e2fc7dd5ac54e5287da71ca..845b9bd62885bfdd8fedba35d40f3bb30c861ae3 100755 (executable)
@@ -59,12 +59,6 @@ class AbstractAlembicTest(unittest.TestCase):
     def setUpClass(cls):
         import re
 
-        parser = argparse.ArgumentParser()
-        parser.add_argument('--blender', required=True)
-        parser.add_argument('--testdir', required=True)
-        parser.add_argument('--alembic-root', required=True)
-        args, _ = parser.parse_known_args()
-
         cls.blender = args.blender
         cls.testdir = pathlib.Path(args.testdir)
         cls.alembic_root = pathlib.Path(args.alembic_root)
@@ -299,4 +293,10 @@ class CurveExportTest(AbstractAlembicTest):
 
 
 if __name__ == '__main__':
-    unittest.main(argv=sys.argv[0:1])
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--blender', required=True)
+    parser.add_argument('--testdir', required=True)
+    parser.add_argument('--alembic-root', required=True)
+    args, remaining = parser.parse_known_args()
+
+    unittest.main(argv=sys.argv[0:1] + remaining)