[TIP] [tox] Capturing output from commands

André Caron andre.l.caron at gmail.com
Mon Jun 13 09:07:37 PDT 2016


Hi there!

I've started using Tox as a means to create a virtual environment, install
Python packages and run a command.  This is really convenient because I can
trivially set up a configuration that depends on a specific Python version
and some internal (DevPI) & external (PyPI) Python packages.

However, I've run into a case where I want to collect the output from the
commands, but Tox also logs a bunch of things to stdout, so I'm getting
mixed output.  I'm having a hard time figuring an automatic way of
separating Tox' output from that of my commands.  Currently, the only
approach that seems to work out of the box is to have all commands log to
stderr, but some of programs I run don't do this and they are out my
control.

I know this is slightly abusing Tox as a task runner, but I'd have to set
up a lot of boilerplate code for Invoke (http://www.pyinvoke.org/) in order
to reliably discover Python, create the virtualenv and install the packages
-- things that Tox already does very well.

I looked through Tox' docs and CLI help, but I can't find a "silent" mode
or a way to force (only) Tox to write to stderr.

Do you have anything to recommend?  If not, any chance you would consider a
patch to introduce a silent mode or a config change to send Tox' logs to
stederr?

Thanks!

André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20160613/8aceff48/attachment.htm>


More information about the testing-in-python mailing list