[Bf-blender-cvs] [1528e5c] master: Run unittest.main() directly

Campbell Barton noreply at git.blender.org
Mon Aug 11 07:23:33 CEST 2014


Commit: 1528e5c20a3aa87302b0df123070927178877713
Author: Campbell Barton
Date:   Mon Aug 11 15:23:00 2014 +1000
Branches: master
https://developer.blender.org/rB1528e5c20a3aa87302b0df123070927178877713

Run unittest.main() directly

===================================================================

M	tests/python/bl_pyapi_mathutils.py

===================================================================

diff --git a/tests/python/bl_pyapi_mathutils.py b/tests/python/bl_pyapi_mathutils.py
index d204e58..7354f55 100644
--- a/tests/python/bl_pyapi_mathutils.py
+++ b/tests/python/bl_pyapi_mathutils.py
@@ -1,8 +1,7 @@
 # Apache License, Version 2.0
 
-# ./blender.bin --background -noaudio --python tests/python/bl_pyapi_mathutils.py
+# ./blender.bin --background -noaudio --python tests/python/bl_pyapi_mathutils.py -- --verbose
 import unittest
-from test import support
 from mathutils import Matrix, Vector
 from mathutils import kdtree
 import math
@@ -291,19 +290,7 @@ class KDTreeTesting(unittest.TestCase):
         with self.assertRaises(RuntimeError):
             k.find(co)
 
-
-def test_main():
-    try:
-        support.run_unittest(MatrixTesting)
-        support.run_unittest(VectorTesting)
-        support.run_unittest(KDTreeTesting)
-    except:
-        import traceback
-        traceback.print_exc()
-
-        # alert CTest we failed
-        import sys
-        sys.exit(1)
-
 if __name__ == '__main__':
-    test_main()
+    import sys
+    sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
+    unittest.main()




More information about the Bf-blender-cvs mailing list