[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29509] branches/soc-2010-leifandersen/ tests/pyunit/ops: Just a few more tests built.

Leif Andersen leif.a.andersen at gmail.com
Thu Jun 17 05:49:27 CEST 2010


Revision: 29509
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29509
Author:   leifandersen
Date:     2010-06-17 05:49:26 +0200 (Thu, 17 Jun 2010)

Log Message:
-----------
Just a few more tests built.
1.  Modified the particle test, to assume that some of the functions in setup.py work properly.  (If not, those should be tested first).

2.  Tested two more functions in setup.py, open_mainfile(), and save_as_mainfile().  Note that at least open_mainfile() currently doesn't work (I think), and a bug report has been made: #22615

3.  Fixed the CMakeLists files to actually point to the tests.

4.  The tests currently run in forground mode, while it's decided if they should be allowed to run in background.  The largest problem with this is that currently blender doesn't quit after each test, even though bpy.ops.wm.exit_blender() is called, this is probably do to the pyunit framework, rather than a bug though.  (Not tested yet).

Modified Paths:
--------------
    branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt
    branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt	2010-06-17 03:29:16 UTC (rev 29508)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/CMakeLists.txt	2010-06-17 03:49:26 UTC (rev 29509)
@@ -1,2 +1,2 @@
-ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/particle.py)
+ADD_TEST(Ops_Particle_Test ${Blender_BINARY_DIR}/bin/blender -P ${Blender_BINARY_DIR}/tests/pyunit/ops/physics/particle.py)
 SET_TESTS_PROPERTIES(Ops_Particle_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py	2010-06-17 03:29:16 UTC (rev 29508)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/physics/particle.py	2010-06-17 03:49:26 UTC (rev 29509)
@@ -4,9 +4,7 @@
 
 class TestParticles(unittest.TestCase):
     def setUp(self):
-        tests.objects.reset_objects()
-        tests.scenes.reset_scenes()
-        tests.build.mesh.cube("Cube")
+        bpy.ops.wm.read_homefile(factory=True)
         cube = bpy.data.objects['Cube']
         bpy.ops.object.particle_system_add({"object":cube})
 
@@ -23,3 +21,5 @@
 
 if __name__ == "__main__":
     unittest.TextTestRunner(verbosity=2).run(suite())
+    print("Hello World")
+    bpy.ops.wm.exit_blender()

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt	2010-06-17 03:29:16 UTC (rev 29508)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/wm/CMakeLists.txt	2010-06-17 03:49:26 UTC (rev 29509)
@@ -1,2 +1,2 @@
-ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -b -P ${Blender_BINARY_DIR}/tests/pyunit/ops/setup.py)
+ADD_TEST(Ops_Setup_Test ${Blender_BINARY_DIR}/bin/blender -P ${Blender_BINARY_DIR}/tests/pyunit/ops/wm/setup.py)
 SET_TESTS_PROPERTIES(Ops_Setup_Test PROPERTIES PASS_REGULAR_EXPRESSION "OK")

Modified: branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py
===================================================================
--- branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py	2010-06-17 03:29:16 UTC (rev 29508)
+++ branches/soc-2010-leifandersen/tests/pyunit/ops/wm/setup.py	2010-06-17 03:49:26 UTC (rev 29509)
@@ -1,14 +1,12 @@
 import bpy
-import tests
 import unittest
 
-class TestSetUp(unittest.TestCase):
+class TestReadHomefile(unittest.TestCase):
 
     # No setUp required for this test, as we'll be testing the various setUp methods here
     def setUp(self):
         pass
 
-
     def test_factory_default(self):
         bpy.ops.wm.read_homefile(factory=True)
 
@@ -18,13 +16,34 @@
     def test_no_params(self):
         bpy.ops.wm.read_homefile()
 
-    def test_load_empty_scene(self):
+class TestLoadBlendfile(unittest.TestCase):
+    def setUp(self):
+        pass
+
+    def test_load_empty_file(self):
+        bpy.ops.wm.open_mainfile(filepath="empty.blend")
+
+    def test_load_file_with_data(self):
         bpy.ops.wm.open_mainfile(filepath="pawns.blend")
 
+class TestSaveBlendfile(unittest.TestCase):
+    def setUp(self):
+        bpy.ops.wm.open_mainfile(filepath="empty.blend")
+
+    def test_save_empty_file(self):
+        bpy.ops.wm.save_mainfile(filepath="empty_out.blend")
+
+    def test_save_file_with_data(self):
+        bpy.ops.wm.open_mainfile(filepath="pawns.blend")
+        bpy.ops.wm.save_mainfile(filepath="pawns_out.blend")
+
 def suite():
     return unittest.TestSuite([
-unittest.TestLoader().loadTestsFromTestCase(TestSetUp),
+unittest.TestLoader().loadTestsFromTestCase(TestReadHomefile),
+unittest.TestLoader().loadTestsFromTestCase(TestLoadBlendfile),
+unittest.TestLoader().loadTestsFromTestCase(TestSaveBlendfile),
 ])
 
 if __name__ == "__main__":
     unittest.TextTestRunner(verbosity=2).run(suite())
+    bpy.ops.wm.exit_blender()





More information about the Bf-blender-cvs mailing list