PyTests: do not load addons in load_py_modules test.
It makes no sense to load add-ons here, we already do that (in a more complete way) in load_addons test, this is only adding overhead and doubling code to maintain). Also do not try to load-as-modules add-ons that are not 2.8-ready, and some other misc fix. load_py_modules test should be passing again now. Thanks to @sergey who did part of the work here as well.
This commit is contained in:
parent
7ec6bca92f
commit
bd7d39f0b9
|
@ -41,6 +41,10 @@ BLACKLIST = {
|
|||
os.path.join("io_blend_utils", "blender_bam-unpacked.whl"),
|
||||
}
|
||||
|
||||
for mod in addon_utils.modules():
|
||||
if addon_utils.module_bl_info(mod)['blender'] < (2, 80, 0):
|
||||
BLACKLIST.add(mod.__name__)
|
||||
|
||||
# Some modules need to add to the `sys.path`.
|
||||
MODULE_SYS_PATHS = {
|
||||
# Runs in a Python subprocess, so its expected its basedir can be imported.
|
||||
|
@ -83,13 +87,6 @@ def module_names_all(mod_dir):
|
|||
yield from module_names_recursive(mod_dir)
|
||||
|
||||
|
||||
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
|
||||
for dirpath, dirnames, filenames in os.walk(path):
|
||||
|
@ -102,25 +99,6 @@ def source_list(path, filename_check=None):
|
|||
yield filepath
|
||||
|
||||
|
||||
def load_addons():
|
||||
modules = addon_modules_sorted()
|
||||
addons = bpy.context.preferences.addons
|
||||
|
||||
# first disable all
|
||||
for mod_name in list(addons.keys()):
|
||||
addon_utils.disable(mod_name, default_set=True)
|
||||
|
||||
assert(bool(addons) is False)
|
||||
|
||||
for mod in modules:
|
||||
mod_name = mod.__name__
|
||||
if mod_name in BLACKLIST:
|
||||
continue
|
||||
addon_utils.enable(mod_name, default_set=True)
|
||||
if not (mod_name in addons):
|
||||
raise Exception("'addon_utils.enable(%r)' call failed" % mod_name)
|
||||
|
||||
|
||||
def load_modules():
|
||||
VERBOSE = os.environ.get("BLENDER_VERBOSE") is not None
|
||||
|
||||
|
@ -166,7 +144,9 @@ def load_modules():
|
|||
# test we tested all files except for presets and templates
|
||||
ignore_paths = [
|
||||
os.sep + "presets" + os.sep,
|
||||
os.sep + "templates" + os.sep,
|
||||
os.sep + "templates_osl" + os.sep,
|
||||
os.sep + "templates_py" + os.sep,
|
||||
os.sep + "bl_app_templates_system" + os.sep,
|
||||
] + ([(os.sep + f + os.sep) for f in BLACKLIST] +
|
||||
[(os.sep + f + ".py") for f in BLACKLIST])
|
||||
|
||||
|
@ -245,7 +225,6 @@ def load_modules():
|
|||
|
||||
|
||||
def main():
|
||||
load_addons()
|
||||
load_modules()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue