<div dir="ltr">I've seen issues with the mock library where patching the same thing multiple times can cause the patchedness to leak out of a test - because the teardown order isn't guaranteed the way it was being used. So if multiple monkeypatches are going to be created at the same scope, the teardown order had better be reverse of construction, or you're going to risk leaking the outer monkeypatch.<div>

<br></div><div>-- lahwran</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 11, 2013 at 8:12 AM, 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"><div class="HOEnZb"><div class="h5">On Fri, Oct 11, 2013 at 10:51 -0300, Bruno Oliveira wrote:<br>
> On Fri, Oct 11, 2013 at 8:35 AM, holger krekel <<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>> wrote:<br>
><br>
> > On Fri, Oct 11, 2013 at 08:25 -0300, Bruno Oliveira wrote:<br>
> > > On Fri, Oct 11, 2013 at 8:14 AM, Vladimir Keleshev <<br>
> > <a href="mailto:vladimir@keleshev.com">vladimir@keleshev.com</a>>wrote:<br>
> > ><br>
> > > > > If you refer to tmpdir/monkeypatch and potentially others, i agree<br>
> > > > > that the current behaviour is more surprising (sharing the tmpdir<br>
> > > > > across multiple fixtures which don't even neccessarily know about<br>
> > each<br>
> > > > > other).<br>
> > > ><br>
> > > > Absolutely. Was a major WAT for me.<br>
> > > ><br>
> > ><br>
> > > Weird, to me it was the exact opposite about tmpdir: it is a common usage<br>
> > > in our code base to create a temporary directory for usage through a test<br>
> > > suite (usually a module containing related tests). And different fixtures<br>
> > > sharing tmpdir makes sense in this scenario.<br>
> ><br>
> > Are you really talking about the pytest fixture "tmpdir" here?<br>
> > "Throughout the test suite" sounds like something else because<br>
> > "tmpdir" is function scoped and created afresh for each test function<br>
> > requesting it.<br>
> ><br>
><br>
> Sorry I wasn't very clear, I meant using the same fixture instance for each<br>
> test, like two fixtures that depend on tmpdir (independently) and both<br>
> fixtures are used in a test function that also needs a tmpdir; in this case<br>
> the test method and fixtures all share the same tmpdir instance.<br>
<br>
</div></div>Ok, and your setup expects to get the same tmpdir then, IIUC.  I might<br>
even have a similar situtation myself in some projects.  So i guess we<br>
will need to introduce a new name for the "each" scoped temporary dir.<br>
That is a minor issue (except that naming is hard, of course) compared<br>
to the actual implementation of the "each" scope.<br>
<br>
cheers,<br>
holger<br>
<div class="im HOEnZb"><br>
> But now I misunderstood the original issue, my apologies, now I see what<br>
> was really meant.<br>
><br>
> Cheers,<br>
> Bruno.<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<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>
</div></div></blockquote></div><br></div>