I am trying to create some unit tests for my pipeline and I am trying to get my head around this whole subprocess thing
This is Pseudo code of what I am trying to do
1)Launch mayabatch with the command to open a file
2)Run a script in the launched maya which modifies the file
3)Check that the file has the new info using unitTest.py modules
So I am using the following code to run my maya from python command line
import subprocess
#set up the arguements to launch maya and open the target file
process=subprocess.Popen(args, env=maya_env,stdout=subprocess.PIPE, stderr=subprocess.PIPE )
So what is happening is that the script jumps directly to step number 3 while mayabatch is till launching and doing it thing. I just want maya to load completely and do it;s thing and then goto to step 3 where I can test the conditions
I tried process.wait() command but that does not solve the problem
What would be cool would to do something like this
Whereby I can send commands to maya to bunch of stuff from the python command line.
This sounds more like a job for maya.standalone. You don’t have to worry about synchronicity, exit codes, or that kind of junk and you can debug in a real debugger if your tests seem not to be working.
This is a non-working example from my codebase. You can’t c-and-p it because the module it’s testing is proprietary – but it give you an idea of how you can set up tests in a standalone. I run this inside Eclipse.
[QUOTE=Theodox;18111]This sounds more like a job for maya.standalone. You don’t have to worry about synchronicity, exit codes, or that kind of junk and you can debug in a real debugger if your tests seem not to be working.