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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-07-25 12:38:33 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-07-25 12:39:10 +0300
commit35d9f681213c56429829afa01b13ee77d621e9d3 (patch)
tree28d7c71f5d166a2356a709eca509ab0f4b8648e6
parentd1dc5e0a53c5a3484b7d20eb3a9847b53a227791 (diff)
Python module test: Don't cfail the test when import failure happens in preset
-rw-r--r--tests/python/bl_load_py_modules.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py
index 80933cd5b61..7ffececd1d9 100644
--- a/tests/python/bl_load_py_modules.py
+++ b/tests/python/bl_load_py_modules.py
@@ -178,15 +178,28 @@ def load_modules():
for f in MODULE_SYS_PATHS.get(mod_name_full, ())
])
- __import__(mod_name_full)
- mod_imp = sys.modules[mod_name_full]
-
- sys.path[:] = sys_path_back
-
- # check we load what we ask for.
- assert(os.path.samefile(mod_imp.__file__, submod_full))
-
- modules.append(mod_imp)
+ try:
+ __import__(mod_name_full)
+ mod_imp = sys.modules[mod_name_full]
+
+ sys.path[:] = sys_path_back
+
+ # check we load what we ask for.
+ assert(os.path.samefile(mod_imp.__file__, submod_full))
+
+ modules.append(mod_imp)
+ except Exception as e:
+ import traceback
+ # Module might fail to import, but we don't want whole test to fail here.
+ # Reasoning:
+ # - This module might be in ignored list (for example, preset or template),
+ # so failing here will cause false-positive test failure.
+ # - If this is module which should not be ignored, it is not added to list
+ # of successfully loaded modules, meaning the test will catch this
+ # import failure.
+ # - We want to catch all failures of this script instead of stopping on
+ # a first big failure.
+ traceback.print_exc()
#
# check which filepaths we didn't load