On Tue, Nov 20, 2012 at 09:52 +0000, Floris Bruynooghe wrote:
> On 19 November 2012 22:04, holger krekel <[email protected]> wrote:
> > A tmpdir requested in function-scope and a tmpdir requested with session
> > scope would be two different directories. I don't see a problem with this,
> > do you?
>
> When they both have a side-effect, like e.g. chdir, this could be an
> issue I thought.
>
> Also, which value does the test function see when it requests tmpdir
> in this case? I'm guessing it would get the tmpdir instance "closest"
> to itself, i.e. function-scope over module- or session-scope. But
> maybe it would be useful if it could also retrieve the value of other
> scopes? E.g. tmpdir.session_scope is the other tmpdir instance?
if you need differentiation you could do::
@pytest.fixture(scope="module")
def tmpdir_module(tmpdir):
return tmpdir
def test_function(tmpdir_module):
...
Alternatively, we could think about::
@pytest.mark.usefixtures("tmpdir:module")
def test_function(tmpdir):
...
best,
holger
_______________________________________________
py-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/py-dev