Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-02-17 12:44:24 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-02-17 13:31:09 +0300
commit395e0c79bdb934d3f0d954ebe76d8e7d0c553986 (patch)
tree02654f04996f1d38c746bf5a62802c3a61375096 /tests
parentcec7db2004526e44d9541340d7c356ae884eafc1 (diff)
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/python/bl_alembic_io_test.py26
1 files changed, 17 insertions, 9 deletions
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():