diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-20 07:10:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-20 07:10:30 +0400 |
commit | e4728bf9100f1ea5b701ecdf8b052be3cfab4f2b (patch) | |
tree | 132673d7a8a208ee6136911874f5a922190897b1 | |
parent | 3c9f50204961b7fa8f6de259fa36deb24696a918 (diff) |
add a test to the addons loaded that tries to load all addons then lists addons that fail.
-rw-r--r-- | source/tests/bl_load_addons.py | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/source/tests/bl_load_addons.py b/source/tests/bl_load_addons.py index 5d9ac750362..fab2e2ead11 100644 --- a/source/tests/bl_load_addons.py +++ b/source/tests/bl_load_addons.py @@ -26,17 +26,46 @@ import addon_utils import sys import imp +def disable_addons(): + # first disable all + addons = bpy.context.user_preferences.addons + for mod_name in list(addons.keys()): + addon_utils.disable(mod_name) + assert(bool(addons) is False) -def reload_addons(do_reload=True, do_reverse=True): + +def test_load_addons(): modules = addon_utils.modules({}) modules.sort(key=lambda mod: mod.__name__) + + disable_addons() + addons = bpy.context.user_preferences.addons - # first disable all - for mod_name in list(addons.keys()): - addon_utils.disable(mod_name) + addons_fail = [] - assert(bool(addons) is False) + for mod in modules: + mod_name = mod.__name__ + print("\tenabling:", mod_name) + addon_utils.enable(mod_name) + if mod_name not in addons: + addons_fail.append(mod_name) + + if addons_fail: + print("addons failed to load (%d):" % len(addons_fail)) + for mod_name in addons_fail: + print(" %s" % mod_name) + else: + print("addons all loaded without errors!") + print("") + + +def reload_addons(do_reload=True, do_reverse=True): + modules = addon_utils.modules({}) + modules.sort(key=lambda mod: mod.__name__) + addons = bpy.context.user_preferences.addons + + disable_addons() # Run twice each time. for i in (0, 1): @@ -62,6 +91,9 @@ def reload_addons(do_reload=True, do_reverse=True): def main(): + # first load addons, print a list of all addons that fail + test_load_addons() + reload_addons(do_reload=False, do_reverse=False) reload_addons(do_reload=False, do_reverse=True) reload_addons(do_reload=True, do_reverse=True) |