Commit: bb4c34fe781e50c705116c4a6bcb024905de3072 Author: Campbell Barton Date: Wed Jan 21 12:56:30 2015 +1100 Branches: master https://developer.blender.org/rBbb4c34fe781e50c705116c4a6bcb024905de3072
Fix Python CTest's, ignore 'addons_contrib' Too many contrib addons are in an unstable state making the test not so useful. Thanks to Sergey initial patch: D1012, redid mostly - but outcome is the same. =================================================================== M tests/python/bl_load_addons.py M tests/python/bl_load_py_modules.py =================================================================== diff --git a/tests/python/bl_load_addons.py b/tests/python/bl_load_addons.py index f04ae64..716d08b 100644 --- a/tests/python/bl_load_addons.py +++ b/tests/python/bl_load_addons.py @@ -20,12 +20,28 @@ # simple script to enable all addons, and disable +""" +./blender.bin --background -noaudio --factory-startup --python tests/python/bl_load_addons.py +""" + import bpy import addon_utils +import os import sys import imp +BLACKLIST_DIRS = ( + os.path.join(bpy.utils.resource_path('USER'), "scripts"), + ) + tuple(addon_utils.paths()[1:]) + + +def addon_modules_sorted(): + modules = addon_utils.modules({}) + modules[:] = [mod for mod in modules if not mod.__file__.startswith(BLACKLIST_DIRS)] + modules.sort(key=lambda mod: mod.__name__) + return modules + def disable_addons(): # first disable all @@ -36,8 +52,7 @@ def disable_addons(): def test_load_addons(): - modules = addon_utils.modules({}) - modules.sort(key=lambda mod: mod.__name__) + modules = addon_modules_sorted() disable_addons() @@ -62,8 +77,7 @@ def test_load_addons(): def reload_addons(do_reload=True, do_reverse=True): - modules = addon_utils.modules({}) - modules.sort(key=lambda mod: mod.__name__) + modules = addon_modules_sorted() addons = bpy.context.user_preferences.addons disable_addons() @@ -76,7 +90,7 @@ def reload_addons(do_reload=True, do_reverse=True): addon_utils.enable(mod_name) assert(mod_name in addons) - for mod in addon_utils.modules({}): + for mod in modules: mod_name = mod.__name__ print("\tdisabling:", mod_name) addon_utils.disable(mod_name) @@ -86,9 +100,9 @@ def reload_addons(do_reload=True, do_reverse=True): if do_reload: imp.reload(sys.modules[mod_name]) - if do_reverse: - # in case order matters when it shouldn't - modules.reverse() + if do_reverse: + # in case order matters when it shouldn't + modules.reverse() def main(): diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py index 9677397..c0ec4ce 100644 --- a/tests/python/bl_load_py_modules.py +++ b/tests/python/bl_load_py_modules.py @@ -20,6 +20,10 @@ # simple script to enable all addons, and disable +""" +./blender.bin --background -noaudio --factory-startup --python tests/python/bl_load_py_modules.py +""" + import bpy import addon_utils @@ -30,8 +34,20 @@ BLACKLIST = { "bl_i18n_utils", "cycles", "io_export_dxf", # TODO, check on why this fails + 'io_import_dxf', # Because of cydxfentity.so dependency } +BLACKLIST_DIRS = ( + os.path.join(bpy.utils.resource_path('USER'), "scripts"), + ) + tuple(addon_utils.paths()[1:]) + + +def addon_modules_sorted(): + modules = addon_utils.modules({}) + modules[:] = [mod for mod in modules if not mod.__file__.startswith(BLACKLIST_DIRS)] + modules.sort(key=lambda mod: mod.__name__) + return modules + def source_list(path, filename_check=None): from os.path import join @@ -47,8 +63,7 @@ def source_list(path, filename_check=None): def load_addons(): - modules = addon_utils.modules({}) - modules.sort(key=lambda mod: mod.__name__) + modules = addon_modules_sorted() addons = bpy.context.user_preferences.addons # first disable all @@ -79,9 +94,10 @@ def load_modules(): for script_path in paths: for mod_dir in sys.path: if mod_dir.startswith(script_path): - if mod_dir not in module_paths: - if os.path.exists(mod_dir): - module_paths.append(mod_dir) + if not mod_dir.startswith(BLACKLIST_DIRS): + if mod_dir not in module_paths: + if os.path.exists(mod_dir): + module_paths.append(mod_dir) # # collect modules from our paths. _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs