Skip to content

Commit

Permalink
Use TearDown in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanierd-adsk committed Mar 6, 2024
1 parent 534f01b commit 260ca02
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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'):
Expand Down Expand Up @@ -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())

0 comments on commit 260ca02

Please sign in to comment.