[pytest-dev] Is it valid to use --boxed with --capture=no?

David Röthlisberger david at stb-tester.com
Mon Sep 29 13:16:24 CEST 2014



On Mon, Sep 29, 2014, at 09:30 AM, holger krekel wrote:
> On Mon, Sep 29, 2014 at 09:25 +0100, David Röthlisberger wrote:
> > On Thu, Sep 25, 2014, at 01:59 PM, holger krekel wrote:
> > > > I need to use "--boxed" to run each test in a different process, because
> > > > very occasionally I get segfaults from the video-capture and
> > > > image-processing libraries that I use, and I don't want that to bring
> > > > down the rest of the tests.
> > > 
> > > With pytest-xdist-1.11 you can also run things with "py.test -n1" now which is
> > > faster and will restart a crashed process if neccessary.  I expect "--boxed"
> > > to be removed if "py.test -n1" proves to be a sufficient.
> > 
> > "-n1" doesn't suffer from the same UnicodeEncodeError that "--boxed"
> > suffers from, but it doesn't run each test in a separate process (and it
> > turns out that I need each test run in a different process for other
> > reasons related to the way I capture video from the system under test).
> > So for now I'll switch to using a separate function for logging, instead
> > of capturing std{out,err}.
> 
> I see.  The output capturing with pytest is not very configurable and
> there are no particular hooks related to it.  If it's clear what would
> be needed it could be implemented without much effort i guess.
> Then again, running with "-s" and implementing your own capturing
> fixtures (possibly with autouse=True) would also work.

My *actual* issue (and I realise now that I never actually mentioned
this in the thread) was that I had implemented my own capturing fixtures
but *even with my own fixtures* and "-s" (aka "--capture=no"), I was
getting UnicodeEncodeError from py/_process/forkedfunc.py.

However I can no longer reproduce this after upgrading from pytest 2.?.?
and xdist 1.? on Mac OS X, to pytest 2.6.3 and xdist 1.11 on Linux
(Ubuntu 14.04).

To be clear, I was not asking for any additional configurability to be
added to pytest; and my use case is now working as I want it to. I'll
leave it to your discretion whether Issue #573 is worth keeping open for
the case of "-s" without custom capturing fixtures.

Thanks again,
Dave.


More information about the Pytest-dev mailing list