Update - ok, so went to implement chad's solution, and was a bit
surprised to find that it didn't work.
Turns out what's going on here is the differing ways standard python
interpreters and maya's interpreter handle echoing of output.
After some digging, I found that this behavior is controlled by
sys.displayhook - and, thankfully, the default displayhook is stored
away in sys.__displayhook__.
def doctestmod(*args, **kwargs):
"""
Wrapper for doctest.testmod that works inside maya gui.
"""
result = None
if sys.displayhook != sys.__displayhook__:
save_displayhook = sys.displayhook
sys.displayhook = sys.__displayhook__
try:
result = doctest.testmod(*args, **kwargs)
finally:
sys.displayhook = save_displayhook
else:
result = doctest.testmod(*args, **kwargs)
return result
Yay!
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---