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:
parent
d3b63817c1
commit
bd127f8aba
1 changed files with 20 additions and 0 deletions
20
tests/conftest.py
Normal file
20
tests/conftest.py
Normal 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)
|
Loading…
Reference in a new issue