From f2452bc9ab9797293c4b51fa022f6a6de82d52e3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 10 Apr 2015 11:38:30 +1000 Subject: Test: blacklist loading addons /w known problems The test now runs without warnings --- tests/python/bl_load_addons.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/python/bl_load_addons.py b/tests/python/bl_load_addons.py index 227edf4164d..85b2f1270f5 100644 --- a/tests/python/bl_load_addons.py +++ b/tests/python/bl_load_addons.py @@ -34,11 +34,28 @@ import imp BLACKLIST_DIRS = ( os.path.join(bpy.utils.resource_path('USER'), "scripts"), ) + tuple(addon_utils.paths()[1:]) +BLACKLIST_ADDONS = set() + +def _init_addon_blacklist(): + + # in case we built without cycles + if not bpy.app.build_options.cycles: + BLACKLIST_ADDONS.add("cycles") + + # in case we built without freestyle + if not bpy.app.build_options.freestyle: + BLACKLIST_ADDONS.add("render_freestyle_svg") + + # netrender has known problems re-registering + BLACKLIST_ADDONS.add("netrender") def addon_modules_sorted(): modules = addon_utils.modules({}) - modules[:] = [mod for mod in modules if not mod.__file__.startswith(BLACKLIST_DIRS)] + modules[:] = [ + mod for mod in modules + if not (mod.__file__.startswith(BLACKLIST_DIRS)) + if not (mod.__name__ in BLACKLIST_ADDONS)] modules.sort(key=lambda mod: mod.__name__) return modules @@ -64,7 +81,7 @@ def test_load_addons(): mod_name = mod.__name__ print("\tenabling:", mod_name) addon_utils.enable(mod_name, default_set=True) - if mod_name not in addons: + if (mod_name not in addons) and (mod_name not in BLACKLIST_ADDONS): addons_fail.append(mod_name) if addons_fail: @@ -106,6 +123,9 @@ def reload_addons(do_reload=True, do_reverse=True): def main(): + + _init_addon_blacklist() + # first load addons, print a list of all addons that fail test_load_addons() -- cgit v1.2.3