[Bf-blender-cvs] [395e0c79bdb] master: Alembic: fix unit test on Windows
Sybren A. Stüvel
noreply at git.blender.org
Mon Feb 17 11:33:47 CET 2020
Commit: 395e0c79bdb934d3f0d954ebe76d8e7d0c553986
Author: Sybren A. Stüvel
Date: Mon Feb 17 10:44:24 2020 +0100
Branches: master
https://developer.blender.org/rB395e0c79bdb934d3f0d954ebe76d8e7d0c553986
Alembic: fix unit test on Windows
There are two issues solved in this commit:
- Our Windows buildbot has slightly different floating point errors than
the Linux one, which meant a larger delta was required for float
comparisons.
- The test performs an export to a temporary Alembic file and
subsequently imports it. Deleting the temporary file was impossible on
Windows because it was still in use. This is now resolved by first
loading the default blend file before deleting the Alembic file.
===================================================================
M tests/python/bl_alembic_io_test.py
===================================================================
diff --git a/tests/python/bl_alembic_io_test.py b/tests/python/bl_alembic_io_test.py
index 0f74b773c32..2786a2db4d7 100644
--- a/tests/python/bl_alembic_io_test.py
+++ b/tests/python/bl_alembic_io_test.py
@@ -269,6 +269,10 @@ class CameraExportImportTest(unittest.TestCase):
self.tempdir = pathlib.Path(self._tempdir.name)
def tearDown(self):
+ # Unload the current blend file to release the imported Alembic file.
+ # This is necessary on Windows in order to be able to delete the
+ # temporary ABC file.
+ bpy.ops.wm.read_homefile()
self._tempdir.cleanup()
def test_export_hierarchy(self):
@@ -336,18 +340,22 @@ class CameraExportImportTest(unittest.TestCase):
actual_rot = ob_eval.matrix_world.to_euler('XYZ')
actual_scale = ob_eval.matrix_world.to_scale()
- self.assertAlmostEqual(expect_loc[0], actual_loc.x, delta=1e-5)
- self.assertAlmostEqual(expect_loc[1], actual_loc.y, delta=1e-5)
- self.assertAlmostEqual(expect_loc[2], actual_loc.z, delta=1e-5)
+ # Precision of the 'almost equal' comparisons.
+ delta_loc = delta_scale = 1e-6
+ delta_rot = math.degrees(1e-6)
- self.assertAlmostEqual(expect_rot_deg[0], math.degrees(actual_rot.x), delta=1e-5)
- self.assertAlmostEqual(expect_rot_deg[1], math.degrees(actual_rot.y), delta=1e-5)
- self.assertAlmostEqual(expect_rot_deg[2], math.degrees(actual_rot.z), delta=1e-5)
+ self.assertAlmostEqual(expect_loc[0], actual_loc.x, delta=delta_loc)
+ self.assertAlmostEqual(expect_loc[1], actual_loc.y, delta=delta_loc)
+ self.assertAlmostEqual(expect_loc[2], actual_loc.z, delta=delta_loc)
+
+ self.assertAlmostEqual(expect_rot_deg[0], math.degrees(actual_rot.x), delta=delta_rot)
+ self.assertAlmostEqual(expect_rot_deg[1], math.degrees(actual_rot.y), delta=delta_rot)
+ self.assertAlmostEqual(expect_rot_deg[2], math.degrees(actual_rot.z), delta=delta_rot)
# This test doesn't use scale.
- self.assertAlmostEqual(1, actual_scale.x, delta=1e-5)
- self.assertAlmostEqual(1, actual_scale.y, delta=1e-5)
- self.assertAlmostEqual(1, actual_scale.z, delta=1e-5)
+ self.assertAlmostEqual(1, actual_scale.x, delta=delta_scale)
+ self.assertAlmostEqual(1, actual_scale.y, delta=delta_scale)
+ self.assertAlmostEqual(1, actual_scale.z, delta=delta_scale)
def main():
More information about the Bf-blender-cvs
mailing list