Fix T51331: fixes for Alembic unit tests on Windows

This commit is contained in:
Sybren A. Stüvel 2017-04-28 15:28:41 +02:00
parent f383c926b4
commit 1e8d7f3b25
Notes: blender-bot 2023-02-14 07:01:33 +01:00
Referenced by issue #51331, [alembic] Unit tests are broken on windows.
2 changed files with 13 additions and 8 deletions

View File

@ -462,7 +462,7 @@ if(WITH_ALEMBIC)
COMMAND
"$<TARGET_FILE_DIR:blender>/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$<CONFIG:Debug>:_d>"
${CMAKE_CURRENT_LIST_DIR}/alembic_tests.py
--blender "${TEST_BLENDER_EXE_BARE}"
--blender "$<TARGET_FILE:blender>"
--testdir "${TEST_SRC_DIR}/alembic"
--alembic-root "${ALEMBIC_ROOT_DIR}"
)

View File

@ -124,6 +124,11 @@ class AbstractAlembicTest(unittest.TestCase):
coloured_output = proc.stdout
output = self.ansi_remove_re.sub(b'', coloured_output).decode('utf8')
# Because of the ANSI colour codes, we need to remove those first before
# decoding to text. This means that we cannot use the universal_newlines
# parameter to subprocess.run(), and have to do the conversion ourselves
output = output.replace('\r\n', '\n').replace('\r', '\n')
if proc.returncode:
raise AbcPropError('Error %d running abcls:\n%s' % (proc.returncode, output))
@ -217,7 +222,7 @@ class HierarchicalAndFlatExportTest(AbstractAlembicTest):
def test_hierarchical_export(self, tempdir: pathlib.Path):
abc = tempdir / 'cubes_hierarchical.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc.as_posix()
self.run_blender('cubes-hierarchy.blend', script)
# Now check the resulting Alembic file.
@ -235,7 +240,7 @@ class HierarchicalAndFlatExportTest(AbstractAlembicTest):
def test_flat_export(self, tempdir: pathlib.Path):
abc = tempdir / 'cubes_flat.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=True)" % abc
"renderable_only=True, visible_layers_only=True, flatten=True)" % abc.as_posix()
self.run_blender('cubes-hierarchy.blend', script)
# Now check the resulting Alembic file.
@ -256,7 +261,7 @@ class DupliGroupExportTest(AbstractAlembicTest):
def test_hierarchical_export(self, tempdir: pathlib.Path):
abc = tempdir / 'dupligroup_hierarchical.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc.as_posix()
self.run_blender('dupligroup-scene.blend', script)
# Now check the resulting Alembic file.
@ -274,7 +279,7 @@ class DupliGroupExportTest(AbstractAlembicTest):
def test_flat_export(self, tempdir: pathlib.Path):
abc = tempdir / 'dupligroup_hierarchical.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=True)" % abc
"renderable_only=True, visible_layers_only=True, flatten=True)" % abc.as_posix()
self.run_blender('dupligroup-scene.blend', script)
# Now check the resulting Alembic file.
@ -295,7 +300,7 @@ class CurveExportTest(AbstractAlembicTest):
def test_export_single_curve(self, tempdir: pathlib.Path):
abc = tempdir / 'single-curve.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc
"renderable_only=True, visible_layers_only=True, flatten=False)" % abc.as_posix()
self.run_blender('single-curve.blend', script)
# Now check the resulting Alembic file.
@ -318,7 +323,7 @@ class HairParticlesExportTest(AbstractAlembicTest):
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=True, visible_layers_only=True, flatten=False, " \
"export_hair=%r, export_particles=%r, as_background_job=False)" \
% (abc, export_hair, export_particles)
% (abc.as_posix(), export_hair, export_particles)
self.run_blender('hair-particles.blend', script)
return abc
@ -377,7 +382,7 @@ class LongNamesExportTest(AbstractAlembicTest):
def test_export_long_names(self, tempdir: pathlib.Path):
abc = tempdir / 'long-names.abc'
script = "import bpy; bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1, " \
"renderable_only=False, visible_layers_only=False, flatten=False)" % abc
"renderable_only=False, visible_layers_only=False, flatten=False)" % abc.as_posix()
self.run_blender('long-names.blend', script)
name_parts = [