diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2018-11-21 20:46:08 -0200 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2018-11-21 20:46:08 -0200 |
commit | 4f5c153d29eb91a76e8f2aa519684e9710ef6624 (patch) | |
tree | 559ed9c7481ea936e20fe02154d41e6f78fbd5af /src/_pytest/tmpdir.py | |
parent | f180ab3e69438559df309e8eac563499bde4fba2 (diff) | |
download | pytest-4f5c153d29eb91a76e8f2aa519684e9710ef6624.tar.gz |
Fix call to os.path.abspath: the argument might already be a Path instance
There's Path.absolute(), but it is not public, see https://bugs.python.org/issue25012.
Diffstat (limited to 'src/_pytest/tmpdir.py')
-rw-r--r-- | src/_pytest/tmpdir.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/_pytest/tmpdir.py b/src/_pytest/tmpdir.py index 937d90c2f..dadb196ea 100644 --- a/src/_pytest/tmpdir.py +++ b/src/_pytest/tmpdir.py @@ -10,6 +10,7 @@ import warnings import attr import py +import six import pytest from .pathlib import ensure_reset_dir @@ -28,8 +29,11 @@ class TempPathFactory(object): _given_basetemp = attr.ib( # using os.path.abspath() to get absolute path instead of resolve() as it - # does not work the same in all platforms - convert=attr.converters.optional(lambda p: Path(os.path.abspath(p))) + # does not work the same in all platforms; there's Path.absolute(), but it is not + # public (see https://bugs.python.org/issue25012) + convert=attr.converters.optional( + lambda p: Path(os.path.abspath(six.text_type(p))) + ) ) _trace = attr.ib() _basetemp = attr.ib(default=None) |