diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-04-07 18:25:09 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2017-04-07 18:29:14 +0300 |
commit | 6cf3fa9ff0b697dc9efeec8578e3341434b6a9ce (patch) | |
tree | 4995879a1a4169df0b953da340121e8c26fdabd7 /tests | |
parent | 063bae4fcc079d0ba7b7f86d327179df36a95146 (diff) |
Tests: import blendfile without modifying sys.path
Diffstat (limited to 'tests')
-rw-r--r-- | tests/python/render_layer/render_layer_common.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/tests/python/render_layer/render_layer_common.py b/tests/python/render_layer/render_layer_common.py index e1785dbd084..645b111b49c 100644 --- a/tests/python/render_layer/render_layer_common.py +++ b/tests/python/render_layer/render_layer_common.py @@ -122,7 +122,8 @@ def get_scene_collections(scene): def query_scene(filepath, name, callbacks): """Return the equivalent to bpy.context.scene""" - import blendfile + from io_blend_utils.blend import blendfile + with blendfile.open_blend(filepath) as blend: scenes = [block for block in blend.blocks if block.code == b'SC'] for scene in scenes: @@ -137,22 +138,6 @@ def query_scene(filepath, name, callbacks): # Utils # ############################################################ -def import_blendfile(): - import bpy - import os - import sys - path = os.path.join( - bpy.utils.resource_path('LOCAL'), - 'scripts', - 'addons', - 'io_blend_utils', - 'blend', - ) - - if path not in sys.path: - sys.path.append(path) - - def dump(data): import json return json.dumps( @@ -199,7 +184,6 @@ class RenderLayerTesting(unittest.TestCase): @classmethod def setUpClass(cls): """Runs once""" - cls.pretest_import_blendfile() cls.pretest_parsing() @classmethod @@ -225,15 +209,6 @@ class RenderLayerTesting(unittest.TestCase): root = cls.get_root() cls.assertTrue(root, "Testdir not set") - @staticmethod - def pretest_import_blendfile(): - """ - Make sure blendfile imports with no problems - name has extra _ because we need this test to run first - """ - import_blendfile() - import blendfile - def setUp(self): """Runs once per test""" import bpy |