From 260ca026d81c2b5f70047003b98c99ed212402b7 Mon Sep 17 00:00:00 2001 From: David Lanier Date: Wed, 6 Mar 2024 09:14:57 +0100 Subject: [PATCH] Use TearDown in tests. --- .../render/mayaToHydra/testFlowViewportAPI.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py b/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py index f07dbec139..b05d9845f5 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py @@ -41,6 +41,10 @@ class TestFlowViewportAPI(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTe def setupScene(self): self.setHdStormRenderer() + def tearDown(self): + #is called after each test : finish by a File New command to check that it's not crashing when cleaning up everything' + cmds.file(new=True, force=True) + #Test adding primitives def test_AddingPrimitives(self): self.setupScene() @@ -99,9 +103,6 @@ def test_AddingPrimitives(self): self.setHdStormRenderer() self.assertSnapshotClose("add_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Finish by a File New command - cmds.file(new=True, force=True) - #Test filtering primitives def test_FilteringPrimitives(self): self.setupScene() @@ -177,9 +178,6 @@ def test_FilteringPrimitives(self): cmds.setAttr(sphereShape + '.subdivisionsAxis', 30) #Unfilter the prim cmds.refresh() self.assertSnapshotClose("filter_VP2AndThenBackToStorm_MovedSphereUnFiltered.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - - #Finish by a File New command - cmds.file(new=True, force=True) #Test Cube grids parameters def test_CubeGrid(self): @@ -229,9 +227,6 @@ def test_CubeGrid(self): self.setHdStormRenderer() self.assertSnapshotClose("cubeGrid_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Finish by a File New command - cmds.file(new=True, force=True) - #Test multiple nodes def test_MultipleNodes(self): self.setupScene() @@ -322,9 +317,6 @@ def test_MultipleNodes(self): self.setHdStormRenderer() self.assertSnapshotClose("multipleNodes_VP2AndThenBackToStorm.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - #Finish by a File New command - cmds.file(new=True, force=True) - #Test multiple viewports def test_MultipleViewports(self): with PluginLoaded('mayaHydraFlowViewportAPILocator'): @@ -396,9 +388,6 @@ def test_MultipleViewports(self): cmds.setFocus ('modelPanel2') self.setHdStormRenderer() self.assertSnapshotClose("multipleViewports_VP2AndThenBackToStorm_modPan2.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - - #Finish by a File New command - cmds.file(new=True, force=True) if __name__ == '__main__': fixturesUtils.runTests(globals())