Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2017-03-02 11:37:10 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-03-02 11:40:17 +0300
commita65af5d0cf63c0cbd7542e2c9f02867ae4dafb7a (patch)
treeed5e4b75ea96bfd48ed4a7a31366a7ce65a5f68a /tests
parent869f2940c2bd17f46695f9213fedd78e6b7c5ac2 (diff)
Layers unittest: isolate the depsgraph crash in individual tests
(and re-order the tests alphabetically)
Diffstat (limited to 'tests')
-rw-r--r--tests/python/render_layer/CMakeLists.txt22
-rw-r--r--tests/python/render_layer/render_layer_common.py6
-rw-r--r--tests/python/render_layer/test_object_link_a.py40
-rw-r--r--tests/python/render_layer/test_object_link_b.py (renamed from tests/python/render_layer/test_link.py)18
-rw-r--r--tests/python/render_layer/test_object_link_c.py43
5 files changed, 103 insertions, 26 deletions
diff --git a/tests/python/render_layer/CMakeLists.txt b/tests/python/render_layer/CMakeLists.txt
index 76d1243ae8a..76718a9ed01 100644
--- a/tests/python/render_layer/CMakeLists.txt
+++ b/tests/python/render_layer/CMakeLists.txt
@@ -56,15 +56,10 @@ macro(RENDER_LAYER_TEST test_name)
)
endmacro()
-RENDER_LAYER_TEST(scene_write_read)
-RENDER_LAYER_TEST(scene_copy)
-RENDER_LAYER_TEST(layer_syncinc)
-RENDER_LAYER_TEST(layer_linking)
-RENDER_LAYER_TEST(collection_rename)
RENDER_LAYER_TEST(active_collection)
-RENDER_LAYER_TEST(object_delete)
-RENDER_LAYER_TEST(link)
-RENDER_LAYER_TEST(operator_context)
+RENDER_LAYER_TEST(collection_rename)
+RENDER_LAYER_TEST(evaluation_visibility_a)
+RENDER_LAYER_TEST(evaluation_visibility_b)
RENDER_LAYER_TEST(object_add_cylinder)
RENDER_LAYER_TEST(object_add_empty)
RENDER_LAYER_TEST(object_add_torus)
@@ -72,5 +67,12 @@ RENDER_LAYER_TEST(object_add_no_collection_cylinder)
RENDER_LAYER_TEST(object_add_no_collection_empty)
RENDER_LAYER_TEST(object_add_no_collection_torus)
RENDER_LAYER_TEST(object_copy)
-RENDER_LAYER_TEST(evaluation_visibility_a)
-RENDER_LAYER_TEST(evaluation_visibility_b)
+RENDER_LAYER_TEST(object_delete)
+RENDER_LAYER_TEST(object_link_a)
+RENDER_LAYER_TEST(object_link_b)
+RENDER_LAYER_TEST(object_link_c)
+RENDER_LAYER_TEST(operator_context)
+RENDER_LAYER_TEST(layer_linking)
+RENDER_LAYER_TEST(layer_syncinc)
+RENDER_LAYER_TEST(scene_copy)
+RENDER_LAYER_TEST(scene_write_read)
diff --git a/tests/python/render_layer/render_layer_common.py b/tests/python/render_layer/render_layer_common.py
index d24b80e0d0a..10b66bf860c 100644
--- a/tests/python/render_layer/render_layer_common.py
+++ b/tests/python/render_layer/render_layer_common.py
@@ -336,3 +336,9 @@ class RenderLayerTesting(unittest.TestCase):
collection = layer.collections[0]
self.assertEqual(len(collection.objects), 1, "New collection is empty")
+ def do_object_link(self, master_collection):
+ import bpy
+ self.assertEqual(master_collection.name, "Master Collection")
+ self.assertEqual(master_collection, bpy.context.scene.master_collection)
+ master_collection.objects.link(bpy.data.objects.new('object', None))
+
diff --git a/tests/python/render_layer/test_object_link_a.py b/tests/python/render_layer/test_object_link_a.py
new file mode 100644
index 00000000000..a9f32aa284f
--- /dev/null
+++ b/tests/python/render_layer/test_object_link_a.py
@@ -0,0 +1,40 @@
+# ./blender.bin --background -noaudio --python tests/python/render_layer/test_link.py -- --testdir="/data/lib/tests/"
+
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+
+import os, sys
+sys.path.append(os.path.dirname(__file__))
+
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+ def test_object_link_scene(self):
+ """
+ See if we can link objects
+ """
+ import bpy
+ master_collection = bpy.context.scene.master_collection
+ self.do_object_link(master_collection)
+
+
+# ############################################################
+# Main - Same For All Render Layer Tests
+# ############################################################
+
+if __name__ == '__main__':
+ import sys
+
+ extra_arguments = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+ sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 2:] if "--" in sys.argv else [])
+
+ UnitTesting._extra_arguments = extra_arguments
+ unittest.main()
diff --git a/tests/python/render_layer/test_link.py b/tests/python/render_layer/test_object_link_b.py
index 387d065dae0..b53d8c19940 100644
--- a/tests/python/render_layer/test_link.py
+++ b/tests/python/render_layer/test_object_link_b.py
@@ -17,28 +17,14 @@ from render_layer_common import *
# ############################################################
class UnitTesting(RenderLayerTesting):
- def do_link(self, master_collection):
- import bpy
- self.assertEqual(master_collection.name, "Master Collection")
- self.assertEqual(master_collection, bpy.context.scene.master_collection)
- master_collection.objects.link(bpy.data.objects.new('object', None))
-
- def test_link_scene(self):
- """
- See if we can link objects
- """
- import bpy
- master_collection = bpy.context.scene.master_collection
- self.do_link(master_collection)
-
- def test_link_context(self):
+ def test_object_link_context(self):
"""
See if we can link objects via bpy.context.scene_collection
"""
import bpy
bpy.context.scene.render_layers.active_index = len(bpy.context.scene.render_layers) - 1
master_collection = bpy.context.scene_collection
- self.do_link(master_collection)
+ self.do_object_link(master_collection)
# ############################################################
diff --git a/tests/python/render_layer/test_object_link_c.py b/tests/python/render_layer/test_object_link_c.py
new file mode 100644
index 00000000000..fc0960e4b29
--- /dev/null
+++ b/tests/python/render_layer/test_object_link_c.py
@@ -0,0 +1,43 @@
+# ./blender.bin --background -noaudio --python tests/python/render_layer/test_link.py -- --testdir="/data/lib/tests/"
+
+# ############################################################
+# Importing - Same For All Render Layer Tests
+# ############################################################
+
+import unittest
+
+import os, sys
+sys.path.append(os.path.dirname(__file__))
+
+from render_layer_common import *
+
+
+# ############################################################
+# Testing
+# ############################################################
+
+class UnitTesting(RenderLayerTesting):
+ def test_object_link_reload(self):
+ """
+ See if we can link objects and not crash
+ """
+ import bpy
+ master_collection = bpy.context.scene.master_collection
+ self.do_object_link(master_collection)
+
+ # force depsgraph to update
+ bpy.ops.wm.read_factory_settings()
+
+
+# ############################################################
+# Main - Same For All Render Layer Tests
+# ############################################################
+
+if __name__ == '__main__':
+ import sys
+
+ extra_arguments = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
+ sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 2:] if "--" in sys.argv else [])
+
+ UnitTesting._extra_arguments = extra_arguments
+ unittest.main()