Skip to content

Commit

Permalink
apply maya.standalone.uninitialize() fix from Autodesk#198 to mayaUsd…
Browse files Browse the repository at this point in the history
… tests

This prevents unittest.main() from exiting on test failures and ensures that
maya.standalone.uninitialize() gets called before returning success or failure.
  • Loading branch information
mattyjams committed Jan 28, 2020
1 parent 9e3c445 commit 5195f1a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,15 @@ foreach(script ${test_script_files})
add_test(
NAME ${target}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${MAYA_PY_EXECUTABLE} -c "from unittest import main; \
COMMAND ${MAYA_PY_EXECUTABLE} -c "import sys; \
from unittest import main; \
import maya.standalone; \
maya.standalone.initialize(name='python'); \
import ${target}; \
main(module=${target}); \
maya.standalone.uninitialize()"
testProg = main(module=${target}, exit=False); \
maya.standalone.uninitialize(); \
sys.exit(not testProg.result.wasSuccessful());
"
)
set_property(TEST ${target} APPEND PROPERTY ENVIRONMENT
"PATH=${path}"
Expand Down

0 comments on commit 5195f1a

Please sign in to comment.