From b5e22e19a015a478a9133efe5128b6f533414cd9 Mon Sep 17 00:00:00 2001 From: debloip-adsk <145056365+debloip-adsk@users.noreply.github.com> Date: Tue, 26 Mar 2024 16:57:20 -0400 Subject: [PATCH] HYDRA-861 & HYDRA-932 : Fix MtoA & LookdevX loading in tests + Related test improvements (#108) * HYDRA-861 : Fix mtoa loading * HYDRA-861 : Make USD stage path relative in testArnoldLights scene * HYDRA-932 : Remove Arnold/mtoa/ai references in testMayaDisplayModes scene * HYDRA-861 : Fix LookdevX loading * HYDRA-861 : Rework plugin loading test infrastructure and fail if plugin can't load * HYDRA-861 : Use relative paths in all test scene files * HYDRA-861 : Kill ADPClientService.exe on test suite end * HYDRA-861 : Add comment for killing ADPClientService * HYDRA-861 : Update point instance picking test and remove specific checkForPlugin functions * HYDRA-861 : Add back skipping testSceneBrowser on OSX * HYDRA-861 : Document force flag usage in taskkill * HYDRA-861 : Add best practices section in test README * HYDRA-861 : Document MAYA_MODULE_PATH usage for MtoA * HYDRA-861 : Re-add existing line about MAYA_MODULE_PATH * HYDRA-861 : Add note on what happens before each test * HYDRA-861 : Add other best practices * HYDRA-861 : Rename _extraPluginsToLoad to _requiredPlugins * HYDRA-861 : Adjust testRefinement and testUsdNativeInstancePicking + remove a bunch of unused imports --- cmake/test.cmake | 23 +++-- test/lib/mayaUsd/render/mayaToHydra/README.md | 37 ++++--- .../mayaToHydra/cpp/testMayaUsdUfeItems.py | 2 - .../mayaToHydra/cpp/testPathInterface.py | 3 - .../render/mayaToHydra/cpp/testPicking.py | 7 +- .../cpp/testPointInstancePicking.py | 6 +- .../mayaToHydra/cpp/testPrimInstancing.py | 2 - .../mayaToHydra/cpp/testSceneCorrectness.py | 2 - .../cpp/testUsdNativeInstancePicking.py | 4 +- .../cpp/testUsdStageLayerMuting.py | 2 - ...stWireframeSelectionHighlightSceneIndex.py | 3 - .../render/mayaToHydra/testArnoldLights.py | 5 +- .../render/mayaToHydra/testCurveTools.py | 2 +- .../render/mayaToHydra/testFlowViewportAPI.py | 2 +- .../render/mayaToHydra/testFootPrintNode.py | 2 +- .../render/mayaToHydra/testImageDiffing.py | 9 +- .../render/mayaToHydra/testLookThrough.py | 2 +- .../mayaToHydra/testMaterialXOnNative.py | 5 +- .../mayaToHydra/testMayaDisplayLayers.py | 2 +- .../mayaToHydra/testMayaDisplayModes.py | 4 +- .../mayaToHydra/testMayaIsolateSelect.py | 2 +- .../render/mayaToHydra/testMayaLights.py | 4 +- .../mayaToHydra/testMayaShadingModes.py | 2 +- .../render/mayaToHydra/testMayaUsdAPIUsage.py | 4 +- .../render/mayaToHydra/testMtohBasicRender.py | 9 +- .../render/mayaToHydra/testMtohDagChanges.py | 7 +- .../mayaToHydra/testNewSceneWithStage.py | 3 - .../render/mayaToHydra/testNurbsPrimitives.py | 2 +- .../render/mayaToHydra/testObjectTemplate.py | 2 +- .../mayaToHydra/testPolygonPrimitives.py | 2 +- .../render/mayaToHydra/testRefinement.py | 4 +- .../render/mayaToHydra/testSceneBrowser.py | 13 +-- .../render/mayaToHydra/testStageAddPrim.py | 6 -- .../testStagePayloadsReferences.py | 6 +- .../render/mayaToHydra/testStageVariants.py | 5 +- .../render/mayaToHydra/testStandardSurface.py | 2 +- .../render/mayaToHydra/testTransforms.py | 5 +- .../render/mayaToHydra/testUSDLights.py | 4 +- .../render/mayaToHydra/testVisibility.py | 2 +- .../UsdStageWithSphereMatXStdSurf.usd | Bin 1230 -> 0 bytes .../UsdStageWithSphereMatXStdSurf.usda | 25 +++++ .../testArnoldLights/testArnoldLights.ma | 4 +- .../testMayaDisplayModes.ma | 68 +------------ .../UsdStageWithSphereMatXStdSurf.usd | Bin 1230 -> 0 bytes .../UsdStageWithSphereMatXStdSurf.usda | 25 +++++ .../testMayaLights/testMayaLights.ma | 4 +- .../UsdStageWithSphereMatXStdSurf.ma | 4 +- .../UsdStageWithSphereMatXStdSurf.usd | Bin 1230 -> 0 bytes .../UsdStageWithSphereMatXStdSurf.usda | 25 +++++ .../testStagePayloadsReferences/FlowerPot.ma | 2 +- .../testStagePayloadsReferences/References.ma | 2 +- .../testStageVariants/testStageVariants.ma | 4 +- .../UsdStageWithSphereMatXStdSurf.usd | Bin 1230 -> 0 bytes .../UsdStageWithSphereMatXStdSurf.usda | 25 +++++ .../testUSDLights/testUSDLights.ma | 8 +- test/testUtils/mtohUtils.py | 90 ++++++++++-------- 56 files changed, 228 insertions(+), 266 deletions(-) delete mode 100644 test/testSamples/testArnoldLights/UsdStageWithSphereMatXStdSurf.usd create mode 100644 test/testSamples/testArnoldLights/UsdStageWithSphereMatXStdSurf.usda delete mode 100644 test/testSamples/testMayaLights/UsdStageWithSphereMatXStdSurf.usd create mode 100644 test/testSamples/testMayaLights/UsdStageWithSphereMatXStdSurf.usda delete mode 100644 test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.usd create mode 100644 test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.usda delete mode 100644 test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd create mode 100644 test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usda diff --git a/cmake/test.cmake b/cmake/test.cmake index 0e6521660d..c5bf6b674d 100644 --- a/cmake/test.cmake +++ b/cmake/test.cmake @@ -224,6 +224,7 @@ finally: set(ALL_PATH_VARS PYTHONPATH + MAYA_MODULE_PATH MAYA_PLUG_IN_PATH MAYA_SCRIPT_PATH XBMLANGPATH @@ -299,18 +300,14 @@ finally: # mtoa if(DEFINED MTOA_LOCATION) - list(APPEND MAYAUSD_VARNAME_PATH - "${MTOA_LOCATION}/bin") - list(APPEND MAYAUSD_VARNAME_MAYA_SCRIPT_PATH - "${MTOA_LOCATION}/scripts/mtoa/mel") - list(APPEND MAYAUSD_VARNAME_MAYA_PXR_PLUGINPATH_NAME - "${MTOA_LOCATION}/usd") - list(APPEND MAYAUSD_VARNAME_MAYA_RENDER_DESC_PATH - "${MTOA_LOCATION}/") - list(APPEND MAYAUSD_MATERIALX_SEARCH_PATH - "${MTOA_LOCATION}/materialx/arnold") - list(APPEND MAYAUSD_MATERIALX_SEARCH_PATH - "${MTOA_LOCATION}/materialx/targets") + # It seems like we need to use MAYA_MODULE_PATH for MtoA to work properly. + # Even if we emulate the .mod file by manually setting the same env vars + # to the same values, MtoA itself will appear to load successfully when + # calling loadPlugin, but some of its extensions will fail to initialize, + # leading to incorrect behavior and test failures. In those cases, it seems + # like having a locally installed MtoA fixed it, but we can't rely on that. + list(APPEND MAYAUSD_VARNAME_MAYA_MODULE_PATH + "${MTOA_LOCATION}") endif() # lookdevx @@ -325,6 +322,8 @@ finally: "${LOOKDEVX_LOCATION}/scripts") list(APPEND MAYAUSD_VARNAME_PYTHONPATH "${LOOKDEVX_LOCATION}/python") + list(APPEND MAYAUSD_VARNAME_MAYA_PLUG_IN_PATH + "${LOOKDEVX_LOCATION}/plug-ins") endif() if(IS_WINDOWS AND DEFINED ENV{PYTHONHOME}) diff --git a/test/lib/mayaUsd/render/mayaToHydra/README.md b/test/lib/mayaUsd/render/mayaToHydra/README.md index 35443a972b..2795de898d 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/README.md +++ b/test/lib/mayaUsd/render/mayaToHydra/README.md @@ -26,7 +26,7 @@ For example, to run testVisibility on RelWithDebInfo : ### Running tests with MayaUSD -Some tests require the MayaUSD plugin to be loaded in order to be run. If MayaUSD cannot be loaded, those tests will be skipped. In order for the test framework to find and load MayaUSD, the `-DMAYAUSD_LOCATION` CMake flag must be set to your MayaUSD installation directory when building MayaHydra. For convenience, you can use the `--mayausd-location` parameter when using the [build.py](../../../../../build.py) script, which will set the CMake flag for you with the given argument. The specified path should point to the directory where your MayaUSD `.mod` file resides. Note that the test framework will not find MayaUSD using the MAYA_MODULE_PATH environment variable. +The tests require MayaUSD in order to be run. In order for the test framework to find and load MayaUSD, the `-DMAYAUSD_LOCATION` CMake flag must be set to your MayaUSD installation directory when building MayaHydra. For convenience, you can use the `--mayausd-location` parameter when using the [build.py](../../../../../build.py) script, which will set the CMake flag for you with the given argument. The specified path should point to the directory where your MayaUSD `.mod` file resides. Note that the test framework will not find MayaUSD using the MAYA_MODULE_PATH environment variable. For example, if your MayaUSD `.mod` file resides in `/install/RelWithDebInfo`, you could call build.py as such : @@ -54,29 +54,34 @@ Looking to add a C++ test suite? See the corresponding [README.md](./cpp/README. To add a new Python-only test suite : 1. Create a new test[...].py file in the current folder. -2. Create a test class that derives from unittest.TestCase (doesn't need to directly inherit from it). -3. Add `test_[...]` methods for each test case in your test suite. -4. Add the following snippet at the bottom of your file : +2. Create a test class that derives from `mtohUtils.MayaHydraBaseTestCase`. +3. Add the line `_file = __file__` in your class definition. +4. If needed, set `_requiredPlugins` to list any plugins that need to be loaded for your test. MayaUSD does not need to be specified, it will be loaded automatically. +5. Add `test_[...]` methods for each test case in your test suite. +6. Add the following snippet at the bottom of your file : ```python if __name__ == '__main__': fixturesUtils.runTests(globals()) ``` -5. Add the name of your test[...].py file to the list of `TEST_SCRIPT_FILES` in the [current folder's CMakeLists.txt](./CMakeLists.txt) +7. Add the name of your test[...].py file to the list of `TEST_SCRIPT_FILES` in the [current folder's CMakeLists.txt](./CMakeLists.txt) Some important notes : -- By default, the mayaHydra plugin will not be loaded. An easy way to load it is to have your test class derive from `MayaHydraBaseTestCase`, which will automatically load mayaHydra when running tests. Don't forget to add the line `_file = __file__` in your class. -- After loading mayaHydra, the renderer will still be on Viewport 2.0. If you want to use another renderer, your test will have to switch to it. If you want to use HdStorm, an easy way to do it is to have your test class derive from `MayaHydraBaseTestCase` and call `self.setHdStormRenderer()` +- Before each test, a new file will be opened and the renderer will be switched to Hydra. If you need to switch between renderers, you can use the `self.setHdStormRenderer()` and `self.setViewport2Renderer()` methods. + +# Best practices +- Don't skip tests unless necessary. If a test requires a certain plugin to be loaded, don't skip the test if the plugin fails to load, as this will falsely be reported as a pass. For such cases, prefer setting the `_requiredPlugins` variable in your test class. +- Use relative paths in test data to make sure the tests will work anywhere. +- Prefer storing USD data in text-form .usda instead of binary, for readability and ease of modification should a test need to be tweaked. # Image comparison Image comparison is done using [idiff from OpenImageIO](https://openimageio.readthedocs.io/en/latest/idiff.html). Some utilities exist to facilitate image comparison tests. Here is the simplest way to get going : -1. Make your test class derive from `MtohTestCase`. -2. Don't forget to add the line `_file = __file__` in your class. -3. Create a folder called [TestName]Test (e.g. for testVisibility, create a folder VisibilityTest) -4. Put the images you want to use for comparison in that folder -5. Call `self.assertImagesClose`, `self.assertImagesEqual` and/or `self.assertSnapshotClose` with the file names of the images to compare with. +1. Make sure your test class derives from `mtohUtils.MayaHydraBaseTestCase` (and has the line `_file = __file__`). +2. Create a folder called [TestName]Test (e.g. for testVisibility, create a folder VisibilityTest) +3. Put the images you want to use for comparison in that folder +4. Call `self.assertImagesClose`, `self.assertImagesEqual` and/or `self.assertSnapshotClose` with the file names of the images to compare with. For the `assert[...]Close` methods, you will need to pass in a fail threshold for individual pixels and a fail percentage for the whole image. Other parameters are also available for you to specify. You can find more information on these parameters on the [idiff documentation page](https://openimageio.readthedocs.io/en/latest/idiff.html). @@ -88,10 +93,4 @@ To create a reference snapshot, an easy way is to first write your test, and the # Utilities -Utility files are located under [/test/testUtils](../../../../testUtils/). Note that at the time of writing this (2023/08/16), many of the utils files and their contents were inherited from the USD plugin, and are not all used. Here are some of the main utilities you might find useful : - -- mtohutils.py : - - `checkForMayaUsdPlugin()` will try to load the MayaUsd plugin and return a boolean indicating if the plugin was loaded successfully. By decorating a test case with the following line, you can run the test only if the MayaUsd plugin is found and loaded : - ```@unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.")``` - - `MayaHydraBaseTestCase` is a base class you can use for your test classes that will provide you with some useful functionality, such as automatically loading the mayaHydra plugin. It also provides a method to use the HdStorm renderer (`setHdStormRenderer`), and another to create a simple scene with a cube (`makeCubeScene`). - - `MtohTestCase` is a class you can use as a base for your test classes that will provide you with image comparison functionality (see [Image comparison](#Image-comparison) section). Note that this class already derives from MayaHydraBaseTestCase, so it will also automatically load the mayaHydra plugin. +Utility files are located under [/test/testUtils](../../../../testUtils/). Note that at the time of writing this (2023/08/16), many of the utils files and their contents were inherited from the USD plugin, and are not all used. diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.py index 744d2ae29a..43424b45a2 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testMayaUsdUfeItems.py @@ -16,7 +16,6 @@ import fixturesUtils import mtohUtils -import unittest from testUtils import PluginLoaded @@ -37,7 +36,6 @@ def setupUsdStage(self): UsdLux.RectLight.Define(usdStage, "/USDRectLight") cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_SkipMayaUsdUfeLights(self): self.setupUsdStage() with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPathInterface.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPathInterface.py index 07b9ec053c..d7c0ac817c 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPathInterface.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPathInterface.py @@ -23,8 +23,6 @@ from testUtils import PluginLoaded -import unittest - class TestPathInterface(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -66,7 +64,6 @@ def setupScene(self): cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PathInterface(self): self.setupScene() with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPicking.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPicking.py index 32bc3647c6..0d66f58808 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPicking.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPicking.py @@ -16,11 +16,10 @@ import fixturesUtils import mayaUtils import mtohUtils -import unittest from testUtils import PluginLoaded -class TestPicking(mtohUtils.MtohTestCase): +class TestPicking(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -89,7 +88,6 @@ def test_PickMayaLight(self): with PluginLoaded('mayaHydraCppTests'): cmds.mayaHydraCppTest(directionalLightObjectName, "simpleLight", f="TestPicking.pickObject") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickUsdMesh(self): import mayaUsd_createStageWithNewLayer stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() @@ -97,7 +95,6 @@ def test_PickUsdMesh(self): with PluginLoaded('mayaHydraCppTests'): cmds.mayaHydraCppTest(cubeObjectName, "mesh", f="TestPicking.pickObject") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickUsdImplicitSurface(self): import mayaUsd_createStageWithNewLayer stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() @@ -105,7 +102,6 @@ def test_PickUsdImplicitSurface(self): with PluginLoaded('mayaHydraCppTests'): cmds.mayaHydraCppTest(cubeObjectName, "mesh", f="TestPicking.pickObject") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickUsdLight(self): import mayaUsd_createStageWithNewLayer stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() @@ -113,7 +109,6 @@ def test_PickUsdLight(self): with PluginLoaded('mayaHydraCppTests'): cmds.mayaHydraCppTest(rectLightObjectName, "rectLight", f="TestPicking.pickObject") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_MarqueeSelection(self): import mayaUsd_createStageWithNewLayer stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer() diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPointInstancePicking.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPointInstancePicking.py index d7213c8827..7021cc6a11 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPointInstancePicking.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPointInstancePicking.py @@ -15,13 +15,12 @@ import maya.cmds as cmds import fixturesUtils import mtohUtils -import unittest import usdUtils import testUtils from testUtils import PluginLoaded -class TestPointInstancePicking(mtohUtils.MtohTestCase): +class TestPointInstancePicking(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -45,7 +44,6 @@ def setUp(self): cmds.setAttr('persp.rotate', -33.4, 63.0, 0, type='float3') cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickPointInstancer(self): with PluginLoaded('mayaHydraCppTests'): @@ -63,7 +61,6 @@ def test_PickPointInstancer(self): self.PICK_PATH + marker, f="TestPointInstancePicking.pickPointInstance") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickInstances(self): with PluginLoaded('mayaHydraCppTests'): @@ -87,7 +84,6 @@ def test_PickInstances(self): self.PICK_PATH + marker, f="TestPointInstancePicking.pickPointInstance") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_PickPrototypes(self): with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPrimInstancing.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPrimInstancing.py index bee463f53f..321093fb31 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testPrimInstancing.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testPrimInstancing.py @@ -16,7 +16,6 @@ import fixturesUtils import mtohUtils -import unittest import testUtils from testUtils import PluginLoaded @@ -32,7 +31,6 @@ def loadUsdScene(self): self.setHdStormRenderer() cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdPrimInstancing(self): self.loadUsdScene() with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneCorrectness.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneCorrectness.py index cf9a27755e..7284cfecf6 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneCorrectness.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testSceneCorrectness.py @@ -16,7 +16,6 @@ import fixturesUtils import mtohUtils -import unittest import testUtils from testUtils import PluginLoaded @@ -31,7 +30,6 @@ def loadUsdScene(self): usdUtils.createStageFromFile(usdScenePath) self.setHdStormRenderer() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_HydraFromUsdSceneCorrectness(self): self.loadUsdScene() cmds.select(all=True) diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdNativeInstancePicking.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdNativeInstancePicking.py index aa1e2d1677..77eb979385 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdNativeInstancePicking.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdNativeInstancePicking.py @@ -15,13 +15,12 @@ import maya.cmds as cmds import fixturesUtils import mtohUtils -import unittest import usdUtils import testUtils from testUtils import PluginLoaded -class TestUsdNativeInstancePicking(mtohUtils.MtohTestCase): +class TestUsdNativeInstancePicking(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -36,7 +35,6 @@ def setUp(self): self.loadUsdScene() cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_NativeInstances(self): with PluginLoaded('mayaHydraCppTests'): instances = ["/cubes_1", "/cubes_2"] diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdStageLayerMuting.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdStageLayerMuting.py index 3c12162c3a..e2d92cca01 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdStageLayerMuting.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testUsdStageLayerMuting.py @@ -16,7 +16,6 @@ import fixturesUtils import mtohUtils -import unittest from testUtils import PluginLoaded @@ -57,7 +56,6 @@ def setupUsdStage(self): cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdStageLayerMuting(self): self.setupUsdStage() with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/cpp/testWireframeSelectionHighlightSceneIndex.py b/test/lib/mayaUsd/render/mayaToHydra/cpp/testWireframeSelectionHighlightSceneIndex.py index 0e2a595606..d92c1532d7 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/cpp/testWireframeSelectionHighlightSceneIndex.py +++ b/test/lib/mayaUsd/render/mayaToHydra/cpp/testWireframeSelectionHighlightSceneIndex.py @@ -4,13 +4,10 @@ import mayaUtils from testUtils import PluginLoaded -import unittest - class TestWireframeSelectionHighlightSceneIndex(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_wireframeSelectionHighlightSceneIndex(self): self.setHdStormRenderer() with PluginLoaded('mayaHydraCppTests'): diff --git a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py index 3592dc3450..b13e984d7e 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testArnoldLights.py @@ -18,12 +18,12 @@ import fixturesUtils import mtohUtils import mayaUtils -import unittest import platform -class TestArnoldLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestArnoldLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ + _requiredPlugins = ['mtoa'] @property def imageDiffFailThreshold(self): @@ -74,7 +74,6 @@ def verifyLightingModes(self, shadowOn): #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) #Test arnold lights (e.g., aiSkyDomeLight,etc.) with a maya native sphere and usd sphere. - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin() and mtohUtils.checkForMtoAPlugin(), "Requires Maya USD and MtoA Plugins.") def test_ArnoldLights(self): cmds.file(new=True, force=True) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py b/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py index 17e894ab64..b139d157d0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testCurveTools.py @@ -18,7 +18,7 @@ import platform -class TestCurveTools(mtohUtils.MtohTestCase): +class TestCurveTools(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py b/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py index 44d222d6a5..824dac9eb2 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testFlowViewportAPI.py @@ -31,7 +31,7 @@ def setRotateY(matrixAsAList, angle): matrixAsAList[2+4*0] = sin(angle) return matrixAsAList -class TestFlowViewportAPI(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestFlowViewportAPI(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py index 586c9f943a..9a71cf66b0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testFootPrintNode.py @@ -26,7 +26,7 @@ HD_STORM = "HdStormRendererPlugin" HD_STORM_OVERRIDE = "mayaHydraRenderOverride_" + HD_STORM -class TestFootPrintNode(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestFootPrintNode(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testImageDiffing.py b/test/lib/mayaUsd/render/mayaToHydra/testImageDiffing.py index 71c7cdc515..52f2a6fe74 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testImageDiffing.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testImageDiffing.py @@ -12,17 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import os.path -import sys -import unittest - -import maya.cmds as cmds -import maya.mel - import fixturesUtils import mtohUtils -class TestImageDiffing(mtohUtils.MtohTestCase): +class TestImageDiffing(mtohUtils.MayaHydraBaseTestCase): """Test the image diffing setup to make sure it works and returns the expected results.""" _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py b/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py index 3e0baf4d2f..e15e7dcad9 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testLookThrough.py @@ -20,7 +20,7 @@ import mayaUtils import platform -class TestLookThrough(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestLookThrough(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMaterialXOnNative.py b/test/lib/mayaUsd/render/mayaToHydra/testMaterialXOnNative.py index 53cc0f5bdb..31605cf430 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMaterialXOnNative.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMaterialXOnNative.py @@ -16,10 +16,10 @@ import mayaUtils import fixturesUtils import mtohUtils -import unittest -class TestMaterialXOnNative(mtohUtils.MtohTestCase): +class TestMaterialXOnNative(mtohUtils.MayaHydraBaseTestCase): _file = __file__ + _requiredPlugins = ['LookdevXMaya'] IMAGEDIFF_FAIL_THRESHOLD = 0.01 IMAGEDIFF_FAIL_PERCENT = 0.1 @@ -30,7 +30,6 @@ def verifySnapshot(self, imageName): self.IMAGEDIFF_FAIL_THRESHOLD, self.IMAGEDIFF_FAIL_PERCENT) - @unittest.skipUnless(mtohUtils.checkForPlugin('LookdevXMaya'), "Requires LookDevX Plugin.") def test_MaterialX(self): mayaUtils.openTestScene("testMaterialX", "RedMtlxSphere.ma") self.setBasicCam(2) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py index d9fa140381..3c1acd82f6 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayLayers.py @@ -20,7 +20,7 @@ import platform -class TestMayaDisplayLayers(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaDisplayLayers(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py index 58fc905909..fea6b8f85a 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaDisplayModes.py @@ -18,12 +18,11 @@ import fixturesUtils import mtohUtils import mayaUtils -import unittest from testUtils import PluginLoaded import platform -class TestMayaDisplayModes(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaDisplayModes(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -100,7 +99,6 @@ def test_MayaDisplayModes(self): self.assertSnapshotClose("displayTextures" + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) cmds.modelEditor(panel, edit=True, displayTextures=False) - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_MayaBoundingBoxDisplayMode(self): with PluginLoaded('mayaHydraFlowViewportAPILocator'): # open a Maya scene that contains USD prims, custom flow viewport data producer prims and maya native prims diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py index a10e66f097..b2225dd630 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaIsolateSelect.py @@ -20,7 +20,7 @@ import platform -class TestMayaIsolateSelect(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaIsolateSelect(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py index 11ee9c441c..b7954f0de3 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaLights.py @@ -18,11 +18,10 @@ import fixturesUtils import mtohUtils import mayaUtils -import unittest import platform -class TestMayaLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -88,7 +87,6 @@ def verifyLightingModes(self, shadowOn): self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) #Test maya lights (e.g., default,directional,point,spot,etc.) with a maya native sphere and usd sphere. - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_MayaLights(self): cmds.file(new=True, force=True) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py index c1314474c3..08ca45a22d 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaShadingModes.py @@ -21,7 +21,7 @@ import platform -class TestMayaShadingModes(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaShadingModes(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py b/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py index 1bd90c3038..23148e37f9 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMayaUsdAPIUsage.py @@ -17,11 +17,10 @@ import maya.cmds as cmds import fixturesUtils import mtohUtils -import unittest import mayaUtils import platform -class TestMayaUsdAPI(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestMayaUsdAPI(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -37,7 +36,6 @@ def imageDiffFailPercent(self): return 3 return 0.2 - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_MovingUsdStage(self): # Load a maya scene with a sphere prim in a UsdStage and a directional light, with HdStorm already being the viewport renderer. testFile = mayaUtils.openTestScene( diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py b/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py index deb6b518b9..7b974d9d14 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMtohBasicRender.py @@ -14,18 +14,13 @@ # limitations under the License. # # Test to make sure that our snapshot-comparison tools work - -import os.path -import sys -import unittest - import maya.cmds as cmds import maya.mel import fixturesUtils import mtohUtils -class TestSnapshot(mtohUtils.MtohTestCase): +class TestSnapshot(mtohUtils.MayaHydraBaseTestCase): """Tests whether our snapshot rendering works with basic Viewport 2.0""" _file = __file__ @@ -60,7 +55,7 @@ def test_flat_orange(self): self.assertRaises(AssertionError, self.assertSnapshotEqual, "flat_orange_bad.png") -class TestMayaHydraRender(mtohUtils.MtohTestCase): +class TestMayaHydraRender(mtohUtils.MayaHydraBaseTestCase): _file = __file__ def test_cube(self): diff --git a/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py b/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py index 2115672c26..838b807170 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testMtohDagChanges.py @@ -13,16 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import sys -import unittest - import maya.cmds as cmds import maya.mel import fixturesUtils import mtohUtils -class TestDagChanges(mtohUtils.MtohTestCase): +class TestDagChanges(mtohUtils.MayaHydraBaseTestCase): _file = __file__ def setUp(self): @@ -262,7 +259,7 @@ def test_instance_move(self): self.assertSnapshotEqual("instances_12.png", self.imageVersion) -class TestUndo(mtohUtils.MtohTestCase): +class TestUndo(mtohUtils.MayaHydraBaseTestCase): _file = __file__ def test_node_creation_undo(self): diff --git a/test/lib/mayaUsd/render/mayaToHydra/testNewSceneWithStage.py b/test/lib/mayaUsd/render/mayaToHydra/testNewSceneWithStage.py index 044a6988af..7bb6d2d8ea 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testNewSceneWithStage.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testNewSceneWithStage.py @@ -17,13 +17,10 @@ import fixturesUtils import mtohUtils -import unittest - class TestStage(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_newFileWithUsdStage(self): import mayaUsd_createStageWithNewLayer import mayaUsd.lib diff --git a/test/lib/mayaUsd/render/mayaToHydra/testNurbsPrimitives.py b/test/lib/mayaUsd/render/mayaToHydra/testNurbsPrimitives.py index d318fd6649..7e67e23c83 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testNurbsPrimitives.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testNurbsPrimitives.py @@ -16,7 +16,7 @@ import fixturesUtils import mtohUtils -class TestNurbsPrimitives(mtohUtils.MtohTestCase): +class TestNurbsPrimitives(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py index 1ea7e04c03..773732ffba 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testObjectTemplate.py @@ -20,7 +20,7 @@ import mayaUtils import platform -class TestObjectTemplate(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestObjectTemplate(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py b/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py index 6ce36c1832..1f2f7b83d4 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testPolygonPrimitives.py @@ -18,7 +18,7 @@ import platform -class TestPolygonPrimitives(mtohUtils.MtohTestCase): +class TestPolygonPrimitives(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testRefinement.py b/test/lib/mayaUsd/render/mayaToHydra/testRefinement.py index 6817cd65a2..61361436fa 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testRefinement.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testRefinement.py @@ -16,10 +16,9 @@ import fixturesUtils import mtohUtils -import unittest import testUtils -class TestRefinement(mtohUtils.MtohTestCase): +class TestRefinement(mtohUtils.MayaHydraBaseTestCase): _file = __file__ IMAGEDIFF_FAIL_THRESHOLD = 0.01 @@ -31,7 +30,6 @@ def verifySnapshot(self, imageName): self.IMAGEDIFF_FAIL_THRESHOLD, self.IMAGEDIFF_FAIL_PERCENT) - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_usdPrim(self): import usdUtils usdScenePath = testUtils.getTestScene('testStagePayloadsReferences', 'cube.usda') diff --git a/test/lib/mayaUsd/render/mayaToHydra/testSceneBrowser.py b/test/lib/mayaUsd/render/mayaToHydra/testSceneBrowser.py index 34030fc50f..bfcd1cba04 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testSceneBrowser.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testSceneBrowser.py @@ -13,7 +13,6 @@ # limitations under the License. # import maya.cmds as cmds -import maya.mel as mel import fixturesUtils import mtohUtils @@ -25,9 +24,7 @@ class TestSceneBrowser(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - - SCENE_BROWSER_TEST_PLUGIN_NAME = 'mayaHydraSceneBrowserTest' - SCENE_BROWSER_TEST_PLUGIN_COMMAND = SCENE_BROWSER_TEST_PLUGIN_NAME + _requiredPlugins = ['mayaHydraSceneBrowserTest'] def setupScene(self): import mayaUsd @@ -44,14 +41,10 @@ def setupScene(self): cmds.directionalLight(name="MayaDirectionalLight") cmds.refresh() - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin() and mtohUtils.checkForPlugin(SCENE_BROWSER_TEST_PLUGIN_NAME) - and platform.system() != "Darwin", - f'Requires mayaUSD and {SCENE_BROWSER_TEST_PLUGIN_NAME} plugins. ' - 'Currently also disabled on OSX.') + @unittest.skipUnless(platform.system() != "Darwin", 'This test is disabled on OSX.') def test_SceneBrowser(self): self.setupScene() - with PluginLoaded(self.SCENE_BROWSER_TEST_PLUGIN_NAME): - mel.eval(self.SCENE_BROWSER_TEST_PLUGIN_COMMAND) + cmds.mayaHydraSceneBrowserTest() if __name__ == '__main__': fixturesUtils.runTests(globals()) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStageAddPrim.py b/test/lib/mayaUsd/render/mayaToHydra/testStageAddPrim.py index f4d0e1abbf..11eba7990a 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStageAddPrim.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStageAddPrim.py @@ -16,17 +16,11 @@ import fixturesUtils import mtohUtils -import mayaUtils -from testUtils import PluginLoaded - -import unittest -import sys class TestStage(mtohUtils.MayaHydraBaseTestCase): # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_addPrim(self): import mayaUsd_createStageWithNewLayer import mayaUsd.lib diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py b/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py index 047885dd90..504ac064ea 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStagePayloadsReferences.py @@ -17,13 +17,12 @@ import maya.cmds as cmds import fixturesUtils import mtohUtils -import unittest import testUtils import mayaUtils import ufe from pxr import Usd, Sdf -class TestUsdStagePayloadsAndReferences(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestUsdStagePayloadsAndReferences(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -95,7 +94,6 @@ def setUpPayloadScene(self): cmds.select(clear=True) - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdStagePayloadsOnTheFly(self): import mayaUsd.ufe import usdUfe @@ -143,7 +141,6 @@ def test_UsdStagePayloadsOnTheFly(self): self.assertTrue(prim.IsLoaded()) self.assertSnapshotClose("cubeLoadWithDescendants.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdStagePayloadsFromScene(self): from mayaUsd import lib as mayaUsdLib self.loadUsdPayloadScene() @@ -162,7 +159,6 @@ def test_UsdStagePayloadsFromScene(self): self.assertEqual(modVariant.GetVariantSelection(), 'FlowerPotB') self.assertSnapshotClose("payloadSceneLoadedPotB.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdStageReferences(self): self.setUpReferenceScene() self.assertSnapshotClose("referencesSceneCreated.png", self.IMAGE_DIFF_FAIL_THRESHOLD, self.IMAGE_DIFF_FAIL_PERCENT) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py index 4c7e699bf5..1b97fcd4ea 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStageVariants.py @@ -17,19 +17,16 @@ import maya.cmds as cmds import fixturesUtils import mtohUtils -import unittest -import testUtils import mayaUtils import ufe -class TestStageVariants(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestStageVariants(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ IMAGE_DIFF_FAIL_THRESHOLD = 0.1 IMAGE_DIFF_FAIL_PERCENT = 0.3 - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_UsdStageVariants(self): import usdUtils from mayaUsd import lib as mayaUsdLib diff --git a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py index 051b3b1270..a5fcf60386 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testStandardSurface.py @@ -19,7 +19,7 @@ import mtohUtils import mayaUtils -class TestStandardSurface(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestStandardSurface(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ diff --git a/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py b/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py index e862dd92f7..70f27b2d6a 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testTransforms.py @@ -13,13 +13,11 @@ # limitations under the License. # import maya.cmds as cmds -import maya.mel import fixturesUtils import mtohUtils -import unittest -class TestTransforms(mtohUtils.MtohTestCase): +class TestTransforms(mtohUtils.MayaHydraBaseTestCase): _file = __file__ IMAGEDIFF_FAIL_THRESHOLD = 0.01 @@ -56,7 +54,6 @@ def test_nativePrim(self): cmds.scale(2, 2, 2, cubeParent, absolute=True) self.verifySnapshot("cube_parent_moved_rotated_scaled.png") - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_usdPrim(self): import mayaUsd import mayaUsd_createStageWithNewLayer diff --git a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py index 53f36fd3ed..fc78af534c 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testUSDLights.py @@ -18,10 +18,9 @@ import fixturesUtils import mtohUtils import mayaUtils -import unittest import platform -class TestUSDLights(mtohUtils.MtohTestCase): #Subclassing mtohUtils.MtohTestCase to be able to call self.assertSnapshotClose +class TestUSDLights(mtohUtils.MayaHydraBaseTestCase): #Subclassing mtohUtils.MayaHydraBaseTestCase to be able to call self.assertSnapshotClose # MayaHydraBaseTestCase.setUpClass requirement. _file = __file__ @@ -82,7 +81,6 @@ def verifyLightingModes(self, shadowOn): #self.assertSnapshotClose("noLight" + imageSuffix + ".png", self.imageDiffFailThreshold, self.imageDiffFailPercent) #Test usd lights (e.g., disk,distant,dome,etc.) with a maya native sphere and usd sphere. - @unittest.skipUnless(mtohUtils.checkForMayaUsdPlugin(), "Requires Maya USD Plugin.") def test_USDLights(self): cmds.file(new=True, force=True) diff --git a/test/lib/mayaUsd/render/mayaToHydra/testVisibility.py b/test/lib/mayaUsd/render/mayaToHydra/testVisibility.py index be6159d426..a80f3c7bb0 100644 --- a/test/lib/mayaUsd/render/mayaToHydra/testVisibility.py +++ b/test/lib/mayaUsd/render/mayaToHydra/testVisibility.py @@ -19,7 +19,7 @@ import fixturesUtils import mtohUtils -class TestVisibility(mtohUtils.MtohTestCase): +class TestVisibility(mtohUtils.MayaHydraBaseTestCase): _file = __file__ IMAGEDIFF_FAIL_THRESHOLD = 0.01 diff --git a/test/testSamples/testArnoldLights/UsdStageWithSphereMatXStdSurf.usd b/test/testSamples/testArnoldLights/UsdStageWithSphereMatXStdSurf.usd deleted file mode 100644 index dca2aed50c76b8282d1f125c5543d34e136f6ea7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmbtUPfrs;6o0$jZ7VIb1sW9)8$zNrl1S>QURr4tR7%Ts6B9MKbf8n`^|g5_j}WwnU?P_&!|da4#Ge! zDE0jR&LR^KuqQZ005Q^sSOX&gg}g_pT}bi4_^GQ zE|~h4RkzC@%opO8%>{_y1xC5Ug5x~7ckaea8Wg*M95f3puL-tewB{N{Q+JRF;M%BW z)D7fJ!`>Kp8#XFwEd-02ha5v|-ZV_zFxT?s1<-6msWnhbbD=c}Q`yyva4?G1EE_qV zfm~2(7=r6*rmi{qiraSTS`E!E!)LJCp56A`EbhOa#dQEmL(`E1hFQ0=hCU750n7o< zdV)9gRKu-Tji%vkK&i0u7^DUayYsLc(@|Y(H!)9h){s}$yoL)k%QR8VGb}R>`{H`t za#~Av)^jw|ZQ@@s45=mOIdlZwYOgj?rq|=aqd(ttl%a7R>6{@4EmYNt8t8Tt*aC-#g}Qt$Bb#nUoqIC3Qy48v?B*T8cM-s3q9Q5yL|@esv(6vrv{DITF%!1L8y zlH!+P$V|bTFeJw5I+ljaS(u2!=4E=Gk + double3 xformOp:translate = (0, 0, -2.3244301402269603) + uniform token[] xformOpOrder = ["xformOp:translate"] +} + +def Scope "mtl" +{ + def Material "standard_surface1" + { + token outputs:mtlx:surface.connect = + + def Shader "standard_surface1" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:out + } + } +} + diff --git a/test/testSamples/testArnoldLights/testArnoldLights.ma b/test/testSamples/testArnoldLights/testArnoldLights.ma index 13318f7f5c..b2b00a310b 100644 --- a/test/testSamples/testArnoldLights/testArnoldLights.ma +++ b/test/testSamples/testArnoldLights/testArnoldLights.ma @@ -89,11 +89,11 @@ createNode mayaUsdProxyShape -n "stageShape1" -p "stage1"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "E:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".fp" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".usdStageTargetLayer" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; createNode transform -n "pSphere1"; rename -uid "8341F116-479B-C1D9-6F2C-62A9A75EE673"; setAttr ".t" -type "double3" 0 0 2.324 ; diff --git a/test/testSamples/testMayaDisplayModes/testMayaDisplayModes.ma b/test/testSamples/testMayaDisplayModes/testMayaDisplayModes.ma index ce9bde55ef..fa033cafc3 100644 --- a/test/testSamples/testMayaDisplayModes/testMayaDisplayModes.ma +++ b/test/testSamples/testMayaDisplayModes/testMayaDisplayModes.ma @@ -7,8 +7,6 @@ requires -nodeType "polyPlatonic" "modelingToolkit" "0.0.0.0"; requires "stereoCamera" "10.0"; requires -nodeType "mayaUsdLayerManager" -nodeType "mayaUsdProxyShape" -dataType "pxrUsdStageData" "mayaUsdPlugin" "0.27.0"; -requires -nodeType "aiOptions" -nodeType "aiAOVDriver" -nodeType "aiAOVFilter" -nodeType "aiSkyDomeLight" - "mtoa" "5.4.0"; currentUnit -l centimeter -a degree -t film; fileInfo "application" "maya"; fileInfo "product" "Maya 2025"; @@ -83,20 +81,6 @@ createNode camera -s -n "sideShape" -p "side"; setAttr ".o" yes; createNode transform -n "stage1"; rename -uid "572BC593-45A8-D62E-274A-AC9996659D7D"; -createNode mayaUsdProxyShape -n "stageShape1" -p "stage1"; - rename -uid "0BC1538A-4275-D25C-B070-DA9B2C0A9747"; - addAttr -r false -ci true -h true -sn "forceCompute" -ln "forceCompute" -min 0 - -max 1 -at "bool"; - addAttr -ci true -h true -sn "usdStageLoadRules" -ln "usdStageLoadRules" -dt "string"; - addAttr -ci true -h true -sn "usdStageTargetLayer" -ln "usdStageTargetLayer" -dt "string"; - setAttr -k off ".v"; - setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; - setAttr ".covm[0]" 0; - setAttr ".cdvm[0]" 0; - setAttr ".fp" -type "string" "E:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; - setAttr ".pp" -type "string" ""; - setAttr ".epp" -type "string" ""; createNode transform -n "pPlane1"; rename -uid "BF71B974-4691-9BE5-B685-EAA0EE2AE03B"; setAttr ".t" -type "double3" 0 -1 0 ; @@ -111,11 +95,6 @@ createNode mesh -n "pPlaneShape1" -p "pPlane1"; setAttr ".dcc" -type "string" "Ambient+Diffuse"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; -createNode transform -n "aiSkyDomeLight1"; - rename -uid "F445CCFF-4A13-14B5-6DC2-43B49F52EC3C"; -createNode aiSkyDomeLight -n "aiSkyDomeLightShape1" -p "aiSkyDomeLight1"; - rename -uid "8912373B-468E-50CE-3251-F8BC54576336"; - setAttr -k off ".v"; createNode transform -n "pTorus1"; rename -uid "B951C7A3-4CC5-49AD-7F5D-B99000A6D913"; setAttr ".t" -type "double3" 0 1.3200451985855537 0 ; @@ -240,21 +219,6 @@ createNode script -n "sceneConfigurationScriptNode"; createNode polyPlane -n "polyPlane1"; rename -uid "CD3BB296-4188-C6F4-E747-E59F1B806502"; setAttr ".cuv" 2; -createNode aiOptions -s -n "defaultArnoldRenderOptions"; - rename -uid "5C8CAC3A-4022-1801-F232-F29A9F4F3DD6"; - setAttr ".version" -type "string" "5.4.0"; -createNode aiAOVFilter -s -n "defaultArnoldFilter"; - rename -uid "02F19E5B-4678-C78F-5BC9-CD89DA6B39FC"; -createNode aiAOVDriver -s -n "defaultArnoldDriver"; - rename -uid "1AFC3678-4ACB-5752-ED36-8AABA1A04BE1"; -createNode aiAOVDriver -s -n "defaultArnoldDisplayDriver"; - rename -uid "98BF77D4-4638-5934-44B7-189F61D8051C"; - setAttr ".ai_translator" -type "string" "maya"; - setAttr ".output_mode" 0; -createNode file -n "file1"; - rename -uid "A5B2E234-4145-AD8E-DC06-C39AE469E979"; - setAttr ".ftn" -type "string" "D:/repos/mayaHydra/ecg-maya-hydra/ecg-maya-hydra/maya-hydra/test/testSamples/testArnoldLights/sky.hdr"; - setAttr ".cs" -type "string" "Raw"; createNode place2dTexture -n "place2dTexture1"; rename -uid "C4487DF0-4526-18EC-36CE-D0BA7685024A"; createNode mayaUsdLayerManager -n "mayaUsdLayerManager1"; @@ -272,7 +236,7 @@ createNode materialInfo -n "materialInfo1"; rename -uid "7A353D3A-4CE0-1AA9-B650-97B907DB1314"; createNode file -n "file2"; rename -uid "024402E0-4F08-CE4B-8A38-2194E8643C1A"; - setAttr ".ftn" -type "string" "D:/repos/mayaHydra/ecg-maya-hydra/ecg-maya-hydra/maya-hydra/test/testSamples/testMayaDisplayModes/diffuse.png"; + setAttr ".ftn" -type "string" "./diffuse.png"; setAttr ".cs" -type "string" "sRGB"; createNode place2dTexture -n "place2dTexture2"; rename -uid "8C4D244C-4C70-F0D0-007B-139D0D202499"; @@ -357,7 +321,6 @@ select -ne :hardwareRenderGlobals; setAttr ".btrs" 512; connectAttr ":time1.o" "stageShape1.tm"; connectAttr "polyPlane1.out" "pPlaneShape1.i"; -connectAttr "file1.oc" "aiSkyDomeLightShape1.sc"; connectAttr "polyTorus1.out" "pTorusShape1.i"; connectAttr "polyPlatonic1.output" "pPlatonicShape1.i"; connectAttr "polyTorus2.out" "pTorusShape2.i"; @@ -369,32 +332,6 @@ relationship "shadowLink" ":lightLinker1" ":initialParticleSE.message" ":default relationship "shadowLink" ":lightLinker1" "standardSurface2SG.message" ":defaultLightSet.message"; connectAttr "layerManager.dli[0]" "defaultLayer.id"; connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid"; -connectAttr ":defaultArnoldDisplayDriver.msg" ":defaultArnoldRenderOptions.drivers" - -na; -connectAttr ":defaultArnoldFilter.msg" ":defaultArnoldRenderOptions.filt"; -connectAttr ":defaultArnoldDriver.msg" ":defaultArnoldRenderOptions.drvr"; -connectAttr ":defaultColorMgtGlobals.cme" "file1.cme"; -connectAttr ":defaultColorMgtGlobals.cfe" "file1.cmcf"; -connectAttr ":defaultColorMgtGlobals.cfp" "file1.cmcp"; -connectAttr ":defaultColorMgtGlobals.wsn" "file1.ws"; -connectAttr "place2dTexture1.c" "file1.c"; -connectAttr "place2dTexture1.tf" "file1.tf"; -connectAttr "place2dTexture1.rf" "file1.rf"; -connectAttr "place2dTexture1.mu" "file1.mu"; -connectAttr "place2dTexture1.mv" "file1.mv"; -connectAttr "place2dTexture1.s" "file1.s"; -connectAttr "place2dTexture1.wu" "file1.wu"; -connectAttr "place2dTexture1.wv" "file1.wv"; -connectAttr "place2dTexture1.re" "file1.re"; -connectAttr "place2dTexture1.of" "file1.of"; -connectAttr "place2dTexture1.r" "file1.ro"; -connectAttr "place2dTexture1.n" "file1.n"; -connectAttr "place2dTexture1.vt1" "file1.vt1"; -connectAttr "place2dTexture1.vt2" "file1.vt2"; -connectAttr "place2dTexture1.vt3" "file1.vt3"; -connectAttr "place2dTexture1.vc1" "file1.vc1"; -connectAttr "place2dTexture1.o" "file1.uv"; -connectAttr "place2dTexture1.ofs" "file1.fs"; connectAttr "file2.oc" "standardSurface2.bc"; connectAttr "standardSurface2.oc" "standardSurface2SG.ss"; connectAttr "pPlaneShape1.iog" "standardSurface2SG.dsm" -na; @@ -428,15 +365,12 @@ connectAttr "standardSurface2.msg" ":defaultShaderList1.s" -na; connectAttr "place2dTexture1.msg" ":defaultRenderUtilityList1.u" -na; connectAttr "place2dTexture2.msg" ":defaultRenderUtilityList1.u" -na; connectAttr "defaultRenderLayer.msg" ":defaultRenderingList1.r" -na; -connectAttr "aiSkyDomeLightShape1.ltd" ":lightList1.l" -na; connectAttr "directionalLightShape1.ltd" ":lightList1.l" -na; connectAttr "pointLightShape1.ltd" ":lightList1.l" -na; -connectAttr "file1.msg" ":defaultTextureList1.tx" -na; connectAttr "file2.msg" ":defaultTextureList1.tx" -na; connectAttr "pTorusShape1.iog" ":initialShadingGroup.dsm" -na; connectAttr "pPlatonicShape1.iog" ":initialShadingGroup.dsm" -na; connectAttr "pTorusShape2.iog" ":initialShadingGroup.dsm" -na; -connectAttr "aiSkyDomeLight1.iog" ":defaultLightSet.dsm" -na; connectAttr "directionalLight1.iog" ":defaultLightSet.dsm" -na; connectAttr "pointLight1.iog" ":defaultLightSet.dsm" -na; // End of testMayaDisplayModes.ma diff --git a/test/testSamples/testMayaLights/UsdStageWithSphereMatXStdSurf.usd b/test/testSamples/testMayaLights/UsdStageWithSphereMatXStdSurf.usd deleted file mode 100644 index dca2aed50c76b8282d1f125c5543d34e136f6ea7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmbtUPfrs;6o0$jZ7VIb1sW9)8$zNrl1S>QURr4tR7%Ts6B9MKbf8n`^|g5_j}WwnU?P_&!|da4#Ge! zDE0jR&LR^KuqQZ005Q^sSOX&gg}g_pT}bi4_^GQ zE|~h4RkzC@%opO8%>{_y1xC5Ug5x~7ckaea8Wg*M95f3puL-tewB{N{Q+JRF;M%BW z)D7fJ!`>Kp8#XFwEd-02ha5v|-ZV_zFxT?s1<-6msWnhbbD=c}Q`yyva4?G1EE_qV zfm~2(7=r6*rmi{qiraSTS`E!E!)LJCp56A`EbhOa#dQEmL(`E1hFQ0=hCU750n7o< zdV)9gRKu-Tji%vkK&i0u7^DUayYsLc(@|Y(H!)9h){s}$yoL)k%QR8VGb}R>`{H`t za#~Av)^jw|ZQ@@s45=mOIdlZwYOgj?rq|=aqd(ttl%a7R>6{@4EmYNt8t8Tt*aC-#g}Qt$Bb#nUoqIC3Qy48v?B*T8cM-s3q9Q5yL|@esv(6vrv{DITF%!1L8y zlH!+P$V|bTFeJw5I+ljaS(u2!=4E=Gk + double3 xformOp:translate = (0, 0, -2.3244301402269603) + uniform token[] xformOpOrder = ["xformOp:translate"] +} + +def Scope "mtl" +{ + def Material "standard_surface1" + { + token outputs:mtlx:surface.connect = + + def Shader "standard_surface1" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:out + } + } +} + diff --git a/test/testSamples/testMayaLights/testMayaLights.ma b/test/testSamples/testMayaLights/testMayaLights.ma index e94cd5d109..ff7476ab80 100644 --- a/test/testSamples/testMayaLights/testMayaLights.ma +++ b/test/testSamples/testMayaLights/testMayaLights.ma @@ -87,12 +87,12 @@ createNode mayaUsdProxyShape -n "stageShape1" -p "stage1"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "E:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".fp" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; setAttr ".forceCompute" yes; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".usdStageTargetLayer" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; createNode transform -n "directionalLight1"; rename -uid "4EB83726-4CD0-CA21-AAEC-80AC18F34BCD"; setAttr ".r" -type "double3" -90 0 0 ; diff --git a/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.ma b/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.ma index 0b2c2250c7..b4e8d41a74 100644 --- a/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.ma +++ b/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.ma @@ -84,12 +84,12 @@ createNode mayaUsdProxyShape -n "stageShape1" -p "stage1"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "X:/GIT/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".fp" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; setAttr ".forceCompute" yes; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "x:/GIT/ecg-maya-hydra/maya-hydra/test/testSamples/testDirectionalLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".usdStageTargetLayer" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; createNode transform -n "directionalLight1"; rename -uid "4EB83726-4CD0-CA21-AAEC-80AC18F34BCD"; setAttr ".t" -type "double3" 0 0 -0.34456476275179959 ; diff --git a/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.usd b/test/testSamples/testMayaUsdAPIUsage/UsdStageWithSphereMatXStdSurf.usd deleted file mode 100644 index dca2aed50c76b8282d1f125c5543d34e136f6ea7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmbtUPfrs;6o0$jZ7VIb1sW9)8$zNrl1S>QURr4tR7%Ts6B9MKbf8n`^|g5_j}WwnU?P_&!|da4#Ge! zDE0jR&LR^KuqQZ005Q^sSOX&gg}g_pT}bi4_^GQ zE|~h4RkzC@%opO8%>{_y1xC5Ug5x~7ckaea8Wg*M95f3puL-tewB{N{Q+JRF;M%BW z)D7fJ!`>Kp8#XFwEd-02ha5v|-ZV_zFxT?s1<-6msWnhbbD=c}Q`yyva4?G1EE_qV zfm~2(7=r6*rmi{qiraSTS`E!E!)LJCp56A`EbhOa#dQEmL(`E1hFQ0=hCU750n7o< zdV)9gRKu-Tji%vkK&i0u7^DUayYsLc(@|Y(H!)9h){s}$yoL)k%QR8VGb}R>`{H`t za#~Av)^jw|ZQ@@s45=mOIdlZwYOgj?rq|=aqd(ttl%a7R>6{@4EmYNt8t8Tt*aC-#g}Qt$Bb#nUoqIC3Qy48v?B*T8cM-s3q9Q5yL|@esv(6vrv{DITF%!1L8y zlH!+P$V|bTFeJw5I+ljaS(u2!=4E=Gk + double3 xformOp:translate = (0, 0, -2.3244301402269603) + uniform token[] xformOpOrder = ["xformOp:translate"] +} + +def Scope "mtl" +{ + def Material "standard_surface1" + { + token outputs:mtlx:surface.connect = + + def Shader "standard_surface1" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:out + } + } +} + diff --git a/test/testSamples/testStagePayloadsReferences/FlowerPot.ma b/test/testSamples/testStagePayloadsReferences/FlowerPot.ma index 55e6d1f457..02fcda7375 100644 --- a/test/testSamples/testStagePayloadsReferences/FlowerPot.ma +++ b/test/testSamples/testStagePayloadsReferences/FlowerPot.ma @@ -89,7 +89,7 @@ createNode mayaUsdProxyShape -n "FlowerPotShape" -p "FlowerPot"; setAttr ".epp" -type "string" ""; setAttr ".forceCompute" yes; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "x:/GIT/maya-hydra-opensource/test/testSamples/testStagePayloadsReferences/FlowerPot.usda"; + setAttr ".usdStageTargetLayer" -type "string" "./FlowerPot.usda"; createNode lightLinker -s -n "lightLinker1"; rename -uid "C6C6B39A-4A43-E8E4-FF7F-43B1BCC75A33"; setAttr -s 2 ".lnk"; diff --git a/test/testSamples/testStagePayloadsReferences/References.ma b/test/testSamples/testStagePayloadsReferences/References.ma index 6411a02488..695e02f229 100644 --- a/test/testSamples/testStagePayloadsReferences/References.ma +++ b/test/testSamples/testStagePayloadsReferences/References.ma @@ -89,7 +89,7 @@ createNode mayaUsdProxyShape -n "referencesExampleShape" -p "referencesExample"; setAttr ".epp" -type "string" ""; setAttr ".forceCompute" yes; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "x:/GIT/maya-hydra-opensource/test/testSamples/testStagePayloadsReferences/referencesExample.usda"; + setAttr ".usdStageTargetLayer" -type "string" "./referencesExample.usda"; createNode lightLinker -s -n "lightLinker1"; rename -uid "8D01FE9F-4A1A-8749-28C0-D2A9E4833F67"; setAttr -s 2 ".lnk"; diff --git a/test/testSamples/testStageVariants/testStageVariants.ma b/test/testSamples/testStageVariants/testStageVariants.ma index de29125551..94e7c00d2a 100644 --- a/test/testSamples/testStageVariants/testStageVariants.ma +++ b/test/testSamples/testStageVariants/testStageVariants.ma @@ -84,11 +84,11 @@ createNode mayaUsdProxyShape -n "variantsShape" -p "variants"; setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "X:/GIT/maya-hydra-opensource/test/testSamples/testStageVariants/variants.usda"; + setAttr ".fp" -type "string" "./variants.usda"; setAttr ".pp" -type "string" ""; setAttr ".epp" -type "string" ""; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "x:/GIT/maya-hydra-opensource/test/testSamples/testStageVariants/variants.usda"; + setAttr ".usdStageTargetLayer" -type "string" "./variants.usda"; createNode lightLinker -s -n "lightLinker1"; rename -uid "8F516624-4B3B-FCC4-CE43-C184E6DB6B3E"; setAttr -s 2 ".lnk"; diff --git a/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd b/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd deleted file mode 100644 index dca2aed50c76b8282d1f125c5543d34e136f6ea7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1230 zcmbtUPfrs;6o0$jZ7VIb1sW9)8$zNrl1S>QURr4tR7%Ts6B9MKbf8n`^|g5_j}WwnU?P_&!|da4#Ge! zDE0jR&LR^KuqQZ005Q^sSOX&gg}g_pT}bi4_^GQ zE|~h4RkzC@%opO8%>{_y1xC5Ug5x~7ckaea8Wg*M95f3puL-tewB{N{Q+JRF;M%BW z)D7fJ!`>Kp8#XFwEd-02ha5v|-ZV_zFxT?s1<-6msWnhbbD=c}Q`yyva4?G1EE_qV zfm~2(7=r6*rmi{qiraSTS`E!E!)LJCp56A`EbhOa#dQEmL(`E1hFQ0=hCU750n7o< zdV)9gRKu-Tji%vkK&i0u7^DUayYsLc(@|Y(H!)9h){s}$yoL)k%QR8VGb}R>`{H`t za#~Av)^jw|ZQ@@s45=mOIdlZwYOgj?rq|=aqd(ttl%a7R>6{@4EmYNt8t8Tt*aC-#g}Qt$Bb#nUoqIC3Qy48v?B*T8cM-s3q9Q5yL|@esv(6vrv{DITF%!1L8y zlH!+P$V|bTFeJw5I+ljaS(u2!=4E=Gk + double3 xformOp:translate = (0, 0, -2.3244301402269603) + uniform token[] xformOpOrder = ["xformOp:translate"] +} + +def Scope "mtl" +{ + def Material "standard_surface1" + { + token outputs:mtlx:surface.connect = + + def Shader "standard_surface1" + { + uniform token info:id = "ND_standard_surface_surfaceshader" + token outputs:out + } + } +} + diff --git a/test/testSamples/testUSDLights/testUSDLights.ma b/test/testSamples/testUSDLights/testUSDLights.ma index 3f6a37b7f1..e08805c80b 100644 --- a/test/testSamples/testUSDLights/testUSDLights.ma +++ b/test/testSamples/testUSDLights/testUSDLights.ma @@ -86,12 +86,12 @@ createNode mayaUsdProxyShape -n "testUSDLights:stageShape1" -p "testUSDLights:st setAttr -k off ".v"; setAttr ".covm[0]" 0 1 1; setAttr ".cdvm[0]" 0 1 1; - setAttr ".fp" -type "string" "E:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".fp" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".epp" -type "string" ""; setAttr ".oslid" -type "string" "anon:0000018889420F50:UsdStageWithSphereMatXStdSurf-session.usda"; - setAttr ".orlid" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".orlid" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".usdStageLoadRules" -type "string" "/=all"; - setAttr ".usdStageTargetLayer" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".usdStageTargetLayer" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; createNode transform -n "testUSDLights:pSphere1"; rename -uid "34F75DDF-48D8-4C4F-A85A-3CB7A16E2341"; setAttr ".t" -type "double3" 0 0 2.324 ; @@ -198,7 +198,7 @@ createNode mayaUsdLayerManager -n "mayaUsdLayerManager1"; setAttr ".lyr[0].fid" -type "string" "usda"; setAttr ".lyr[0].szd" -type "string" ""; setAttr ".lyr[0].ann" yes; - setAttr ".lyr[1].id" -type "string" "e:/MayaHydra/ecg-maya-hydra/maya-hydra/test/testSamples/testUSDLights/UsdStageWithSphereMatXStdSurf.usd"; + setAttr ".lyr[1].id" -type "string" "./UsdStageWithSphereMatXStdSurf.usda"; setAttr ".lyr[1].fid" -type "string" "usd"; setAttr ".lyr[1].szd" -type "string" ( "#usda 1.0\n\ndef Sphere \"Sphere1\" (\n prepend apiSchemas = [\"MaterialBindingAPI\"]\n)\n{\n rel material:binding = \n double3 xformOp:translate = (0, 0, -2.3244301402269603)\n uniform token[] xformOpOrder = [\"xformOp:translate\"]\n}\n\ndef Scope \"mtl\"\n{\n def Material \"standard_surface1\"\n {\n token outputs:mtlx:surface.connect = \n\n def Shader \"standard_surface1\"\n {\n uniform token info:id = \"ND_standard_surface_surfaceshader\"\n token outputs:out\n }\n }\n}\n\ndef DistantLight \"DistantLight1\"\n{\n float inputs:angle = 0.53\n color3f inputs:shadow:color\n bool inputs:shadow:enable = 1\n token visibility = \"inherited\"\n float3 xformOp:rotateXYZ = (-90, 0, 0)\n double3 xformOp:translate = (0, 2, 0)\n uniform token[] xformOpOrder = [\"xformOp:translate\", \"xformOp:rotateXYZ\"]\n}\n\ndef DiskLight \"DiskLight1\"\n{\n float inputs:radius = 2.4875622\n token visibility = \"inherited\"\n float3 xformOp:rotateXYZ = (-90, 0, 0)\n" diff --git a/test/testUtils/mtohUtils.py b/test/testUtils/mtohUtils.py index afee67a92e..252e99b856 100644 --- a/test/testUtils/mtohUtils.py +++ b/test/testUtils/mtohUtils.py @@ -24,10 +24,13 @@ import testUtils from imageUtils import ImageDiffingTestCase +import platform +import subprocess import sys HD_STORM = "HdStormRendererPlugin" HD_STORM_OVERRIDE = "mayaHydraRenderOverride_" + HD_STORM +MAYAUSD_PLUGIN_NAME = 'mayaUsdPlugin' def checkForPlugin(pluginName: str): try: @@ -36,27 +39,44 @@ def checkForPlugin(pluginName: str): return False return True -def checkForMayaUsdPlugin(): - return checkForPlugin('mayaUsdPlugin') +class MayaHydraBaseTestCase(unittest.TestCase, ImageDiffingTestCase): + '''Base class for mayaHydra unit tests.''' -def checkForMtoAPlugin(): - return checkForPlugin('mtoa') + DEFAULT_CAM_DIST = 24 -class MayaHydraBaseTestCase(unittest.TestCase): - '''Base class for mayaHydra unit tests without image comparison.''' + _inputDir = None + # Variables to be set in subclasses _file = None - - DEFAULT_CAM_DIST = 24 + _requiredPlugins = [] @classmethod def setUpClass(cls): if cls._file is None: - raise ValueError("Subclasses of MayaHydraBaseTestCase must " - "define `_file = __file__`") - # Set up all tests with their own test directory to write out test-specific coverage information - fixturesUtils.setUpClass(cls._file, 'mayaHydra', - initializeStandalone=False) + raise ValueError("Subclasses of MayaHydraBaseTestCase must define " + "`_file = __file__`") + + inputPath = fixturesUtils.setUpClass( + cls._file, 'mayaHydra', initializeStandalone=False, + suffix=('_' + cls.__name__)) + + if cls._inputDir is None: + inputDirName = os.path.splitext(os.path.basename(cls._file))[0] + inputDirName = testUtils.stripPrefix(inputDirName, 'test') + if not inputDirName.endswith('Test'): + inputDirName += 'Test' + cls._inputDir = os.path.join(inputPath, inputDirName) + + cls._testDir = os.path.abspath('.') + + if MAYAUSD_PLUGIN_NAME not in cls._requiredPlugins: + cls._requiredPlugins.append(MAYAUSD_PLUGIN_NAME) + + for pluginToLoad in cls._requiredPlugins: + # If a plugin fails to load, the entire test suite will be immediately aborted. + # Note that in the case of mtoa, the plugin might load successfully but not + # initialize properly, which means issues will only be caught in the actual tests. + cmds.loadPlugin(pluginToLoad) def setUp(self): # Maya is not closed/reset between each test of a test suite, @@ -65,6 +85,18 @@ def setUp(self): cmds.file(new=True, force=True) self.setHdStormRenderer() + @classmethod + def tearDownClass(cls): + if platform.system() == "Windows": + # On Windows, ADPClientService can linger around after a test ends and Maya closes, + # keeping a handle open into the temporary test directory that holds preferences, + # settings, etc. This prevents us from deleting the temporary test directory, and + # thus from cleaning the build. To avoid this, kill the process immediately. + # So far (2024-03-25), this has only been observed when using LookdevX. + # Note that the force (/f) flag seems necessary, omitting it did not end up killing + # the process. + subprocess.run(['taskkill', '/f', '/im', 'ADPClientService.exe']) + def setHdStormRenderer(self): self.activeEditor = cmds.playblast(activeEditor=1) cmds.modelEditor( @@ -137,30 +169,6 @@ def trace(self, msg): def traceIndex(self, msg): self.trace(msg.format(str(self.getIndex()))) -class MtohTestCase(MayaHydraBaseTestCase, ImageDiffingTestCase): - '''Base class for mayaHydra unit tests with image comparison.''' - - _inputDir = None - - @classmethod - def setUpClass(cls): - if cls._file is None: - raise ValueError("Subclasses of MtohTestCase, must define " - "`_file = __file__`") - - inputPath = fixturesUtils.setUpClass( - cls._file, 'mayaHydra', initializeStandalone=False, - suffix=('_' + cls.__name__)) - - if cls._inputDir is None: - inputDirName = os.path.splitext(os.path.basename(cls._file))[0] - inputDirName = testUtils.stripPrefix(inputDirName, 'test') - if not inputDirName.endswith('Test'): - inputDirName += 'Test' - cls._inputDir = os.path.join(inputPath, inputDirName) - - cls._testDir = os.path.abspath('.') - def resolveRefImage(self, refImage, imageVersion): if not os.path.isabs(refImage): if imageVersion: @@ -173,21 +181,21 @@ def assertImagesClose(self, image1, image2, fail, failpercent, image1Version=Non hardfail=None, warn=None, warnpercent=None, hardwarn=None, perceptual=False): imagePath1 = self.resolveRefImage(image1, image1Version) imagePath2 = self.resolveRefImage(image2, image2Version) - super(MtohTestCase, self).assertImagesClose(imagePath1, imagePath2, fail, failpercent, hardfail, + super(MayaHydraBaseTestCase, self).assertImagesClose(imagePath1, imagePath2, fail, failpercent, hardfail, warn, warnpercent, hardwarn, perceptual) def assertImagesEqual(self, image1, image2, image1Version=None, image2Version=None): imagePath1 = self.resolveRefImage(image1, image1Version) imagePath2 = self.resolveRefImage(image2, image2Version) - super(MtohTestCase, self).assertImagesEqual(imagePath1, imagePath2) + super(MayaHydraBaseTestCase, self).assertImagesEqual(imagePath1, imagePath2) def assertSnapshotClose(self, refImage, fail, failpercent, imageVersion=None, hardfail=None, warn=None, warnpercent=None, hardwarn=None, perceptual=False): refImage = self.resolveRefImage(refImage, imageVersion) - super(MtohTestCase, self).assertSnapshotClose(refImage, fail, failpercent, hardfail, + super(MayaHydraBaseTestCase, self).assertSnapshotClose(refImage, fail, failpercent, hardfail, warn, warnpercent, hardwarn, perceptual) def assertSnapshotEqual(self, refImage, imageVersion=None): '''Use of this method is discouraged, as renders can vary slightly between renderer architectures.''' refImage = self.resolveRefImage(refImage, imageVersion) - super(MtohTestCase, self).assertSnapshotEqual(refImage) + super(MayaHydraBaseTestCase, self).assertSnapshotEqual(refImage)