Skip to content

Commit

Permalink
use fixturesUtils in all UsdMayaAdaptor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyjams committed Aug 5, 2020
1 parent ba66d66 commit ec6780a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
4 changes: 3 additions & 1 deletion test/lib/usd/translators/testUsdMayaAdaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import unittest

import fixturesUtils


class testUsdMayaAdaptor(unittest.TestCase):
@classmethod
Expand All @@ -35,7 +37,7 @@ def setUpClass(cls):
# We are testing that the Plug-based lookup mechanism correctly
# identifies and loads the necessary libraries when a schema adapter is
# requested.
standalone.initialize('usd')
cls.inputPath = fixturesUtils.setUpClass(__file__, loadPlugin=False)

@classmethod
def tearDownClass(cls):
Expand Down
8 changes: 5 additions & 3 deletions test/lib/usd/translators/testUsdMayaAdaptorGeom.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import os
import unittest

import fixturesUtils


class testUsdMayaAdaptorGeom(unittest.TestCase):

Expand All @@ -33,10 +35,10 @@ def tearDownClass(cls):

@classmethod
def setUpClass(cls):
standalone.initialize('usd')
cmds.loadPlugin('pxrUsd')
cls.inputPath = fixturesUtils.setUpClass(__file__)

usdFile = os.path.abspath('UsdAttrs.usda')
usdFile = os.path.join(cls.inputPath, 'UsdMayaAdaptorGeomTest',
'UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none')

def testImportImageable(self):
Expand Down
29 changes: 13 additions & 16 deletions test/lib/usd/translators/testUsdMayaAdaptorMetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import os
import unittest

import fixturesUtils


class testUsdMayaAdaptorMetadata(unittest.TestCase):

Expand All @@ -35,17 +37,18 @@ def tearDownClass(cls):

@classmethod
def setUpClass(cls):
standalone.initialize('usd')
cmds.loadPlugin('pxrUsd')
cls.inputPath = fixturesUtils.setUpClass(__file__)

cls.inputUsdFile = os.path.join(cls.inputPath,
'UsdMayaAdaptorMetadataTest', 'UsdAttrs.usda')

def testImport_HiddenInstanceableKind(self):
"""
Tests that the adaptor mechanism can import
hidden, instanceable, and kind metadata properly.
"""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none')
cmds.usdImport(file=self.inputUsdFile, shadingMode='none')

# pCube1 and pCube2 have USD_kind.
self.assertEqual(cmds.getAttr('pCube1.USD_kind'), 'potato')
Expand Down Expand Up @@ -74,8 +77,7 @@ def testImport_HiddenInstanceableKind(self):
def testImport_HiddenInstanceable(self):
"""Tests import with only hidden, instanceable metadata and not kind."""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none',
cmds.usdImport(file=self.inputUsdFile, shadingMode='none',
metadata=['hidden', 'instanceable'])

# pCube1 and pCube2 have USD_kind, but that shouldn't be imported.
Expand All @@ -97,8 +99,7 @@ def testImport_HiddenInstanceable(self):
def testImport_TypeName(self):
"""Tests import with metadata=typeName manually specified."""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none',
cmds.usdImport(file=self.inputUsdFile, shadingMode='none',
metadata=["typeName"])

# typeName metadata should come through.
Expand All @@ -120,8 +121,7 @@ def testImport_TypeName(self):
def testImport_GeomModelAPI(self):
"""Tests importing UsdGeomModelAPI attributes."""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none',
cmds.usdImport(file=self.inputUsdFile, shadingMode='none',
apiSchema=['GeomModelAPI'])

worldProxy = mayaUsdLib.Adaptor('World')
Expand Down Expand Up @@ -154,8 +154,7 @@ def testExport(self):
the correct metadata in the output USD file.
"""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none')
cmds.usdImport(file=self.inputUsdFile, shadingMode='none')

newUsdFilePath = os.path.abspath('UsdAttrsNew.usda')
cmds.usdExport(file=newUsdFilePath, shadingMode='none')
Expand Down Expand Up @@ -185,8 +184,7 @@ def testExport(self):
def testExport_GeomModelAPI(self):
"""Tests export with the GeomModelAPI."""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none',
cmds.usdImport(file=self.inputUsdFile, shadingMode='none',
apiSchema=['GeomModelAPI'])

newUsdFilePath = os.path.abspath('UsdAttrsNew_GeomModelAPI.usda')
Expand All @@ -203,8 +201,7 @@ def testExport_GeomModelAPI(self):
def testExport_GeomModelAPI_MotionAPI(self):
"""Tests export with both the GeomModelAPI and MotionAPI."""
cmds.file(new=True, force=True)
usdFile = os.path.abspath('UsdAttrs.usda')
cmds.usdImport(file=usdFile, shadingMode='none',
cmds.usdImport(file=self.inputUsdFile, shadingMode='none',
apiSchema=['GeomModelAPI', 'MotionAPI'])

newUsdFilePath = os.path.abspath('UsdAttrsNew_TwoAPIs.usda')
Expand Down
11 changes: 5 additions & 6 deletions test/lib/usd/translators/testUsdMayaAdaptorUndoRedo.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,15 @@

import unittest

import fixturesUtils


class testUsdMayaAdaptorUndoRedo(unittest.TestCase):
@classmethod
def setUpClass(cls):
standalone.initialize('usd')

# We load the pxrUsd plugin here to ensure that the usdUndoHelperCmd
# has been registered. See the documentation on UsdMayaAdaptor for more
# detail.
cmds.loadPlugin('pxrUsd')
# We load the plugin here to ensure that the usdUndoHelperCmd has been
# registered. See the documentation on UsdMayaAdaptor for more detail.
cls.inputPath = fixturesUtils.setUpClass(__file__, loadPlugin=True)

@classmethod
def tearDownClass(cls):
Expand Down

0 comments on commit ec6780a

Please sign in to comment.