On Mon, Nov 19, 2012 at 1:07 AM, RjOllos <ry...@physiosonics.com> wrote:

> When I put `print` statements inside a unit test case I don't see any
> output in the console window. Any idea of why this might be?
>
> I know it's not the most elegant way to debug, but sometimes the quickest
> way to get some info about a variable when debugging some Trac code,
> particularly since I'm still a beginning with python and not proficient
> with pdb and other tools that exist.
>

Python testrunners like to swallow output from print statements,
unfortunately.  Some also like to swallow pdb breakpoints.

I believe the Right Way to do this sort of debugging in tests is to use
Python's logging framework.  But I'm always too lazy to look this up.  I
usually end up doing ``logfile = open("/tmp/test.log", "a"); print >>
logfile, "log message"; logfile.close();`` instead, and `tail -f
/tmp/test.log` in another console window while I run my tests.

-Ethan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to trac-dev@googlegroups.com.
To unsubscribe from this group, send email to 
trac-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en.

Reply via email to