[Maya-Python] Nose verbosity, Maya stdout

78 views
Skip to first unread message

Marcus Ottosson

unread,
Jul 23, 2015, 8:44:30 AM7/23/15
to python_in...@googlegroups.com

I’m struggling with getting output from tests running through nose, after having initialised Maya.

This is what I get.

$ mayapy -m nose test_something.py
F

That is, nothing. This is the test.

test_something.py

import time

import maya.standalone
maya.standalone.initialize()

def test_something():
    print "I'll be printed"
    time.sleep(0.5)
    assert False

When removing the call to maya.standalone.initialize(), I get what I’m expecting.

$ mayapy -m nose test_something.py
======================================================================
FAIL: test_something.test_something
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Program Files\Autodesk\Maya2015\Python\lib\site-packages\nose\case.py", line 19
7, in runTest
    self.test(*self.arg)
  File "c:\Users\marcus\test_something.py", line 7, in test_something
    assert False
AssertionError:
-------------------- >> begin captured stdout << ---------------------
I'll be printed

--------------------- >> end captured stdout << ----------------------

It seems Maya is crippling stdout during initialisation, and I’ll need it back somehow.

Anyone have any ideas?

--
Marcus Ottosson
konstr...@gmail.com

Anthony Tan

unread,
Jul 23, 2015, 9:15:41 AM7/23/15
to python_in...@googlegroups.com
It's 11pm here, so excuse if this doesn't sound sane but what happens if you amend your test_something.py to call nose internally (i.e. wrap it in a if __name__ == '__main__' blob) and fire it off that way.
 
Also, dunno if it's of interest, but it works for me here on my setup, but that's Maya 2013/x64/win (and therefore Python 2.6.4 as well..) and I'm not able to run your command directly - it complains that nose is a package and can't be directly executed so I'm invoking it directly by doing -m nose.__main__ runme.py
 
Curiosity, what are you running it against on that side?
 
(Note again - 11pm. May not be making sense, apologies if i'm talking rubbish. I've been playing with PHP and watching the Tour)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
 

Marcus Ottosson

unread,
Jul 23, 2015, 9:41:01 AM7/23/15
to python_in...@googlegroups.com
Thanks Tan, experimenting with this now..

Marcus Ottosson

unread,
Jul 23, 2015, 11:12:48 AM7/23/15
to python_in...@googlegroups.com
This works for me. Thanks!

On 23 July 2015 at 15:40, Marcus Ottosson <konstr...@gmail.com> wrote:
Thanks Tan, experimenting with this now..



--
Marcus Ottosson
konstr...@gmail.com

Reply all
Reply to author
Forward
0 new messages