Commit: a6d4ac28f56b5470ae7492a1cea7e3967e1fb836
Author: Dalai Felinto
Date:   Mon Mar 20 10:30:19 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBa6d4ac28f56b5470ae7492a1cea7e3967e1fb836

Layers unittesting: update after doversion changes

Collections now are called "Collection 1", instead of "1"

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

M       tests/python/render_layer/render_layer_common.py
M       tests/python/render_layer/test_active_collection.py
M       tests/python/render_layer/test_layer_linking.py
M       tests/python/render_layer/test_object_copy.py
M       tests/python/render_layer/test_object_delete.py
M       tests/python/render_layer/test_operator_context.py
M       tests/python/render_layer/test_scene_copy.py
M       tests/python/render_layer/test_scene_write_read.py
M       tests/python/render_layer/test_syncing.py

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

diff --git a/tests/python/render_layer/render_layer_common.py 
b/tests/python/render_layer/render_layer_common.py
index ddfbc62960..f12994bb51 100644
--- a/tests/python/render_layer/render_layer_common.py
+++ b/tests/python/render_layer/render_layer_common.py
@@ -258,6 +258,7 @@ class RenderLayerTesting(unittest.TestCase):
 
             # open file
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
 
             # create sub-collections
             three_b = bpy.data.objects.get('T.3b')
@@ -360,6 +361,25 @@ class RenderLayerTesting(unittest.TestCase):
         while master_collection.collections:
             
master_collection.collections.remove(master_collection.collections[0])
 
+    def rename_collections(self, collection=None):
+        """
+        Rename 'Collection 1' to '1'
+        """
+        def strip_name(collection):
+            import re
+            if collection.name.startswith("Default Collection"):
+                collection.name = '1'
+            else:
+                collection.name = re.findall(r'\d+', collection.name)[0]
+
+        if collection is None:
+            import bpy
+            collection = bpy.context.scene.master_collection
+
+        for nested_collection in collection.collections:
+            strip_name(nested_collection)
+            self.rename_collections(nested_collection)
+
 
 class MoveSceneCollectionTesting(RenderLayerTesting):
     """
diff --git a/tests/python/render_layer/test_active_collection.py 
b/tests/python/render_layer/test_active_collection.py
index 5cd66538ff..e3eaafa4ba 100644
--- a/tests/python/render_layer/test_active_collection.py
+++ b/tests/python/render_layer/test_active_collection.py
@@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
 
         # open file
         bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+        self.rename_collections()
 
         # create sub-collections
         three_b = bpy.data.objects.get('T.3b')
diff --git a/tests/python/render_layer/test_layer_linking.py 
b/tests/python/render_layer/test_layer_linking.py
index 35af3d6a96..ff6ae8766c 100644
--- a/tests/python/render_layer/test_layer_linking.py
+++ b/tests/python/render_layer/test_layer_linking.py
@@ -29,6 +29,7 @@ class UnitTesting(RenderLayerTesting):
 
             # open file
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
 
             # create sub-collections
             three_b = bpy.data.objects.get('T.3b')
diff --git a/tests/python/render_layer/test_object_copy.py 
b/tests/python/render_layer/test_object_copy.py
index 419f8f418a..5b16875f6a 100644
--- a/tests/python/render_layer/test_object_copy.py
+++ b/tests/python/render_layer/test_object_copy.py
@@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
 
             # open file
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
 
             # create sub-collections
             three_b = bpy.data.objects.get('T.3b')
diff --git a/tests/python/render_layer/test_object_delete.py 
b/tests/python/render_layer/test_object_delete.py
index 693357d7de..d5752b1eaf 100644
--- a/tests/python/render_layer/test_object_delete.py
+++ b/tests/python/render_layer/test_object_delete.py
@@ -30,6 +30,7 @@ class UnitTesting(RenderLayerTesting):
 
             # open file
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
 
             # create sub-collections
             three_b = bpy.data.objects.get('T.3b')
diff --git a/tests/python/render_layer/test_operator_context.py 
b/tests/python/render_layer/test_operator_context.py
index 3c51327fbe..fd90732b0c 100644
--- a/tests/python/render_layer/test_operator_context.py
+++ b/tests/python/render_layer/test_operator_context.py
@@ -75,6 +75,7 @@ class UnitTesting(RenderLayerTesting):
         ROOT = self.get_root()
         filepath_layers = os.path.join(ROOT, 'layers.blend')
         bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+        self.rename_collections()
 
         # change the file
         three_b = bpy.data.objects.get('T.3b')
diff --git a/tests/python/render_layer/test_scene_copy.py 
b/tests/python/render_layer/test_scene_copy.py
index bfa473a11d..af8138db8a 100644
--- a/tests/python/render_layer/test_scene_copy.py
+++ b/tests/python/render_layer/test_scene_copy.py
@@ -36,6 +36,7 @@ class UnitTesting(RenderLayerTesting):
             filepath_json = os.path.join(dirpath, "{0}.json".format(copy_mode))
 
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
             bpy.ops.scene.new(type=copy_mode)
             bpy.ops.wm.save_mainfile('EXEC_DEFAULT', filepath=filepath_saved)
 
diff --git a/tests/python/render_layer/test_scene_write_read.py 
b/tests/python/render_layer/test_scene_write_read.py
index 020c81f7d3..6d7d3766ff 100644
--- a/tests/python/render_layer/test_scene_write_read.py
+++ b/tests/python/render_layer/test_scene_write_read.py
@@ -35,6 +35,7 @@ class UnitTesting(RenderLayerTesting):
 
             # doversion + write test
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
             bpy.ops.wm.save_mainfile('EXEC_DEFAULT', 
filepath=filepath_doversion)
 
             datas = query_scene(filepath_doversion, 'Main', data_callbacks)
@@ -54,6 +55,7 @@ class UnitTesting(RenderLayerTesting):
             if do_read:
                 # read test, simply open and save the file
                 bpy.ops.wm.open_mainfile('EXEC_DEFAULT', 
filepath=filepath_doversion)
+                self.rename_collections()
                 bpy.ops.wm.save_mainfile('EXEC_DEFAULT', 
filepath=filepath_saved)
 
                 datas = query_scene(filepath_saved, 'Main', data_callbacks)
diff --git a/tests/python/render_layer/test_syncing.py 
b/tests/python/render_layer/test_syncing.py
index da367ac381..843df22dd7 100644
--- a/tests/python/render_layer/test_syncing.py
+++ b/tests/python/render_layer/test_syncing.py
@@ -29,6 +29,7 @@ class UnitTesting(RenderLayerTesting):
 
             # open file
             bpy.ops.wm.open_mainfile('EXEC_DEFAULT', filepath=filepath_layers)
+            self.rename_collections()
 
             # create sub-collections
             three_b = bpy.data.objects.get('T.3b')

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to