<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On 18 September 2014 20:56, holger krekel <span dir="ltr"><<a href="mailto:holger@merlinux.eu" target="_blank">holger@merlinux.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Sep 18, 2014 at 20:51 +0200, Anatoly Bubenkov wrote:<br>
> hmm, but that grouping is not important for session scoped fixtures, right?<br>
> i mean, what's the sense of tearing down the session-scoped fixture, even<br>
> if most likely it will be not used by any test, earlier than the end of the<br>
> session?<br>
<br>
</span>Parametrized session-scoped fixtures, for example, may depend on being torn<br>
down, not all be active at the same time.  In any case, it's part of a<br>
general scheme to teardown fixtures as early as possible, not as late as<br>
possible.  We can discuss/play with that and introduce an option which<br>
prohibits it, possibly.<br>
<br></blockquote><div>ok i see now a bit more, so, the solution, proposed in an article is still actual, because there's no strict guarantee</div><div>but the reasoning was described in a wrong way - i'll fix that, thanks! </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
best,<br>
holger<br>
<br>
P.S: i bet you are using gmail, right? (because of your top-level<br>
posting style -- i often prefer inlined comments because it allows to<br>
get statements in context).<br></blockquote><div>i liked that way earlier also, not anymore :)</div><div>but in pytest-dev at least i'll try to keep this style, np</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> it should be ok for that fixture to live till the end of the session, and<br>
> then any randomization should not matter<br>
> i agree that for modules and classes grouping is nice, though<br>
><br>
><br>
> On 18 September 2014 20:46, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>> wrote:<br>
><br>
> > On Thu, Sep 18, 2014 at 20:35 +0200, Anatoly Bubenkov wrote:<br>
> > > yes per testing subprocess, as i've already asked in the comments section<br>
> > > on the paylogic developer portal, im waiting for your confirmation that's<br>
> > > NOT by design that we were getting multiple test sessions per test<br>
> > > subprocess<br>
> > > so i'll need to fix the article then<br>
> ><br>
> > yes, it's not by design.  It was more an implementation incident.<br>
> ><br>
> > > BTW: now im reading the code again, it looks like even with randomization<br>
> > > plugin it should not matter?<br>
> ><br>
> > pytest relies on the following property of test collections: if a test<br>
> > at index I1 uses a session-scoped fixture X and at an index I2>I1 X is not<br>
> > used than for any I3>I2 X will not be used, either.  If this is not<br>
> > true for any given testing process then the fixture will be torn down<br>
> > and setup again (at I3).  pytest groups tests so in general this property<br>
> > is true (see here:<br>
> ><br>
> > <a href="https://pytest.org/latest/fixture.html#automatic-grouping-of-tests-by-fixture-instances" target="_blank">https://pytest.org/latest/fixture.html#automatic-grouping-of-tests-by-fixture-instances</a><br>
> > for how it groups).<br>
> ><br>
> > If you have multiple parametrized session-scoped fixtures (not very common)<br>
> > or item randomization the above property is likely not true but that<br>
> > already<br>
> > is true then for single-process execution.<br>
> ><br>
> > best,<br>
> > holger<br>
> ><br>
> > > On 18 September 2014 20:31, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>> wrote:<br>
> > ><br>
> > > > On Thu, Sep 18, 2014 at 20:24 +0200, Anatoly Bubenkov wrote:<br>
> > > > > so, this is again guaranteed that there will be only one session per<br>
> > test<br>
> > > > > run on any test slave?<br>
> > > ><br>
> > > > there is always one session object only but i think you are asking if a<br>
> > > > session-scoped fixture will only be instantiated once per testing<br>
> > > > subprocess, right?  In general this should be the case if i am not<br>
> > missing<br>
> > > > something (when you use a test randomization plugin, then it's probably<br>
> > > > not the case).<br>
> > > ><br>
> > > > best,<br>
> > > > holger<br>
> > > ><br>
> > > > > On 18 September 2014 20:23, Anatoly Bubenkov <<a href="mailto:bubenkoff@gmail.com">bubenkoff@gmail.com</a>><br>
> > > > wrote:<br>
> > > > ><br>
> > > > > > Great!<br>
> > > > > > thanks a lot everyone involved<br>
> > > > > ><br>
> > > > > > On 18 September 2014 20:21, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>><br>
> > wrote:<br>
> > > > > ><br>
> > > > > >><br>
> > > > > >> I just released pytest-xdist-1.11, the distributed testing plugin<br>
> > for<br>
> > > > > >> pytest.<br>
> > > > > >> It introduces automatic restarting of crashed nodes, courtesy of a<br>
> > > > > >> complete PR from Floris Bruynooghe.  This also works well together<br>
> > > > with<br>
> > > > > >> pytest-timeout by the same author: When one or more test functions<br>
> > > > hang<br>
> > > > > >> or crash, the overall test run will still complete and report<br>
> > about<br>
> > > > the<br>
> > > > > >> incidents.  See the changelog below for more changes and the pypi<br>
> > > > > >> project page for what pytest-xdist offers in general:<br>
> > > > > >><br>
> > > > > >>     <a href="https://pypi.python.org/pypi/pytest-xdist/" target="_blank">https://pypi.python.org/pypi/pytest-xdist/</a><br>
> > > > > >><br>
> > > > > >> Thanks also to an undisclosed company who partly funded the work<br>
> > > > > >> and to Andreas Pelme for contributing analysis of a fixture<br>
> > caching<br>
> > > > > >> failure including a test.<br>
> > > > > >><br>
> > > > > >> best,<br>
> > > > > >> Holger Krekel<br>
> > > > > >><br>
> > > > > >><br>
> > > > > >> 1.11<br>
> > > > > >> -------------------------<br>
> > > > > >><br>
> > > > > >> - fix pytest/xdist issue485 (also depends on py-1.4.22):<br>
> > > > > >>   attach stdout/stderr on --boxed processes that die.<br>
> > > > > >><br>
> > > > > >> - fix pytest/xdist issue503: make sure that a node has usually<br>
> > > > > >>   two items to execute to avoid scoped fixtures to be torn down<br>
> > > > > >>   pre-maturely (fixture teardown/setup is "nextitem" sensitive).<br>
> > > > > >>   Thanks to Andreas Pelme for bug analysis and failing test.<br>
> > > > > >><br>
> > > > > >> - restart crashed nodes by internally refactoring setup handling<br>
> > > > > >>   of nodes.  Also includes better code documentation.<br>
> > > > > >>   Many thanks to Floris Bruynooghe for the complete PR.<br>
> > > > > >><br>
> > > > > >> _______________________________________________<br>
> > > > > >> Pytest-dev mailing list<br>
> > > > > >> <a href="mailto:Pytest-dev@python.org">Pytest-dev@python.org</a><br>
> > > > > >> <a href="https://mail.python.org/mailman/listinfo/pytest-dev" target="_blank">https://mail.python.org/mailman/listinfo/pytest-dev</a><br>
> > > > > >><br>
> > > > > ><br>
> > > > > ><br>
> > > > > ><br>
> > > > > > --<br>
> > > > > > Anatoly Bubenkov<br>
> > > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > ><br>
> > > > > --<br>
> > > > > Anatoly Bubenkov<br>
> > > ><br>
> > ><br>
> > ><br>
> > ><br>
> > > --<br>
> > > Anatoly Bubenkov<br>
> ><br>
><br>
><br>
><br>
> --<br>
> Anatoly Bubenkov<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Anatoly Bubenkov<br></div>
</div></div>