Tests: blendfile versioning: print loaded file/linked ID by default.

This makes the logs fairly verbose, but it is not displayed by default
anyway, and it is the only easy way to find out exactly which file or ID
is breaking the test.
This commit is contained in:
Bastien Montagne
2024-09-05 14:16:09 +02:00
parent eeefd9a69c
commit 3d2408fb4e

View File

@@ -108,18 +108,25 @@ class TestBlendFileOpenAllTestFiles(TestHelper):
for bfp in self.blendfile_paths:
if self.skip_path_check(bfp):
continue
if not self.args.is_quiet:
print(f"Trying to open {bfp}")
bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True)
bpy.ops.wm.open_mainfile(filepath=bfp, load_ui=False)
def link_append(self, do_link):
operation_name = "link" if do_link else "append"
for bfp in self.blendfile_paths:
if self.skip_path_check(bfp):
continue
bpy.ops.wm.read_homefile(use_empty=True, use_factory_startup=True)
with bpy.data.libraries.load(bfp, link=do_link) as (lib_in, lib_out):
if len(lib_in.collections):
if not self.args.is_quiet:
print(f"Trying to {operation_name} {bfp}/Collection/{lib_in.collections[0]}")
lib_out.collections.append(lib_in.collections[0])
elif len(lib_in.objects):
if not self.args.is_quiet:
print(f"Trying to {operation_name} {bfp}/Object/{lib_in.objects[0]}")
lib_out.objects.append(lib_in.objects[0])
def test_link(self):
@@ -149,6 +156,15 @@ def argparse_create():
required=False,
)
parser.add_argument(
"--quiet",
dest="is_quiet",
type=bool,
default=False,
help="Whether to quiet prints of all blendfile read/link attempts",
required=False,
)
parser.add_argument(
"--slice-range",
dest="slice_range",