[TIP] pdb, coverage.py, etc... what's the right tool?

Marius Gedminas marius at gedmin.as
Fri Jun 20 05:30:29 PDT 2014


On Thu, Jun 19, 2014 at 12:51:12AM -0700, Colin Kincaid Williams wrote:
> I want to step through a python script with a main method and print
> out everything similar to what is displayed in an interactive python
> session.

There are tools that can show you what statements are being executed,
but I don't think there are tools that can print the results of
expression statements that discard their value.

> Print and use output redirection, or just write it to a file.
> I read on Stack Overflow that I would want to use coverage, but I
> didn't see this use case explicitly in it's docs. Right now I'm
> copying and pasting everything and it's really tedious. Is there an
> easy to use tool built for this?

Nobody mentioned trace yet

  python -m trace --trace yourscript.py

Marius Gedminas
-- 
The worst thing about going out is that you're not in your house.
        -- Kimiko Ross
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20140620/ae52b322/attachment.pgp>


More information about the testing-in-python mailing list