From 1e8d7f3b25a3dd6d118123c889374f32c0f8af51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 28 Apr 2017 15:28:41 +0200 Subject: Fix T51331: fixes for Alembic unit tests on Windows --- tests/python/CMakeLists.txt | 2 +- tests/python/alembic_tests.py | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'tests/python') diff --git a/tests/python/CMakeLists.txt b/tests/python/CMakeLists.txt index 1dddacc191b..1ee5ce8b88a 100644 --- a/tests/python/CMakeLists.txt +++ b/tests/python/CMakeLists.txt @@ -462,7 +462,7 @@ if(WITH_ALEMBIC) COMMAND "$/${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}/python/bin/python$<$:_d>" ${CMAKE_CURRENT_LIST_DIR}/alembic_tests.py - --blender "${TEST_BLENDER_EXE_BARE}" + --blender "$" --testdir "${TEST_SRC_DIR}/alembic" --alembic-root "${ALEMBIC_ROOT_DIR}" ) diff --git a/tests/python/alembic_tests.py b/tests/python/alembic_tests.py index 2a2dd0230cf..e36a6391298 100755 --- a/tests/python/alembic_tests.py +++ b/tests/python/alembic_tests.py @@ -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 = [ -- cgit v1.2.3