fix #4680 - ensure tmpdir and tmp_path are the same

This commit is contained in:
Ronny Pfannschmidt 2019-01-27 13:05:34 +01:00
parent 9905a73ae0
commit f7d7555521
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1 @@
Ensure the ``tmpdir`` and the ``tmp_path`` fixtures are the same folder.

View File

@ -167,7 +167,7 @@ def _mk_tmp(request, factory):
@pytest.fixture
def tmpdir(request, tmpdir_factory):
def tmpdir(tmp_path):
"""Return a temporary directory path object
which is unique to each test function invocation,
created as a sub directory of the base temporary
@ -176,7 +176,7 @@ def tmpdir(request, tmpdir_factory):
.. _`py.path.local`: https://py.readthedocs.io/en/latest/path.html
"""
return _mk_tmp(request, tmpdir_factory)
return py.path.local(tmp_path)
@pytest.fixture

View File

@ -337,3 +337,7 @@ def attempt_symlink_to(path, to_path):
Path(path).symlink_to(Path(to_path))
except OSError:
pytest.skip("could not create symbolic link")
def test_tmpdir_equals_tmp_path(tmpdir, tmp_path):
assert Path(tmpdir) == tmp_path