1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Shadow the built in tmpdir fixture to use our Path object

* Uses the same generation method as the built in tmpdir, simply
  returns a different object type.
This commit is contained in:
Donald Stufft 2013-08-21 22:28:15 -04:00
parent d3b63817c1
commit bd127f8aba

20
tests/conftest.py Normal file
View file

@ -0,0 +1,20 @@
import py
import pytest
from tests.lib.path import Path
@pytest.fixture
def tmpdir(request):
"""
Return a temporary directory path object which is unique to each test
function invocation, created as a sub directory of the base temporary
directory. The returned object is a ``tests.lib.path.Path`` object.
This is taken from pytest itself but modified to return our typical
path object instead of py.path.local.
"""
name = request.node.name
name = py.std.re.sub("[\W]", "_", name)
tmp = request.config._tmpdirhandler.mktemp(name, numbered=True)
return Path(tmp)