Skip to content Skip to sidebar Skip to footer

Opening A CommandPort In Standalone Maya For Unit Testing

I am writing unit tests for a script that sends python code to Autodesk Maya trough the commandPort. The script works; it sends code fine to Maya which executes it. For testing pur

Solution 1:

You can't run commandPort in a standalone, it relies on the GUI loop. You can, however, run a script which makes the standalone listen on a socket, or us a remoting package like zeromq or RPyC. This link includes some hints on how to set it up and points at a github gist with a simple html based RPC server that runs in a standalone.

Alternatively, you can just fire up a complete GUI Maya to control using commandport, although that will slow your tests down considerably.


Solution 2:

if you're on Linux or Mac, I highly recommend dcc automation project (won't work on Windows). Mainly I liked how rather seamlessly it integrates into Maya.

My setup for unit testing is just launching whole GUI maya, though. I tried the standalone setup and it was just not worth it. C++ unit test suite still run with standalone Maya though, but startup time is just impeding. It's much faster to leave Maya GUI in the background, and test suite connects to it each time a test needs to be launched. Much faster feedback.

I wrote a more in-depth article on my automated test setup for Maya, if you're interested - Automated testing and Maya plugin development.


Post a Comment for "Opening A CommandPort In Standalone Maya For Unit Testing"