[py-dev] Storing terminal width in py.test config object

holger krekel holger at merlinux.eu
Mon Jun 25 16:36:00 CEST 2012


On Mon, Jun 25, 2012 at 16:09 +0200, Ronny Pfannschmidt wrote:
> given the nature of the problem,
> i think its wrong to go for terminal width there,
> instead we should serialize the exponations,
> and render them on the master.
> 
> that way we could also have other ways of display more nicely.

It's indeed true that a frontend-independent format that can be
rendered on the master would be nice ... um, html? (not sure it's a joke).

holger


> On 06/25/2012 03:54 PM, holger krekel wrote:
> >On Mon, Jun 25, 2012 at 11:06 +0100, Floris Bruynooghe wrote:
> >>On 21 June 2012 07:16, holger krekel<holger at merlinux.eu>  wrote:
> >>>On Thu, Jun 21, 2012 at 00:16 +0100, Floris Bruynooghe wrote:
> >>>>An annoyance of the pytest_assertrepr_compare hook is that it can not
> >>>>normally access the terminal width since usually it is called while
> >>>>stdout and stderr are being captured which breaks
> >>>>py.io.get_terminal_width().  Since I think it is fairly rare to get a
> >>>>changing terminal size during a py.test run I would propose py.test
> >>>>stores the terminal width on it's config object which would solve that
> >>>>annoyance.
> >>>>
> >>>>Would this be a reasonable thing to do?
> >>>
> >>>I think so.  However, I'd like to have this working with xdist as well
> >>>and slaves generally do not have access to the master terminal.
> >>>I guess xdist could take care to explicitely transfer terminal_width
> >>>once it is on the config object. You can leave the latter to me if you prefer.
> >>
> >>Ok, as I'm in no hurry on this I've created an issue for this so I
> >>don't completely loose track.  I don't mind attempting to look at
> >>xdist when I get round to it, I probably need to get to know it for my
> >>pytest-timeout plugin anyway.
> >
> >There is a semi-official way to pass data between master and slaves,
> >see this test:
> >
> >     https://bitbucket.org/hpk42/pytest-xdist/src/6d23d5c1326f/testing/acceptance_test.py#cl-159
> >
> >With this, you could define the appropriate code in the xdist-plugin
> >(or in any other plugin) to make config.terminal_width available
> >on slaves.  I guess that pytest itself should grow a config.terminal_width
> >and xdist would just take care to transfer it.
> >
> >Actually, it would be interesting to make a virtual py.io.TerminalWriter()
> >available which uses the settings from the master terminalwriter (as
> >used in the terminal plugin). It could be used to produce colored
> >output on the slaves to be shown on the master terminal.  I am hesitant
> >to point you to py.io.TerminalWritter, however, because its code is in
> >need for a cleanup and a unicode-review ... but maybe this is unrelated.
> >
> >best,
> >holger
> >_______________________________________________
> >py-dev mailing list
> >py-dev at codespeak.net
> >http://codespeak.net/mailman/listinfo/py-dev
> 



More information about the Pytest-dev mailing list