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.
This commit is contained in:
parent
f180ab3e69
commit
4f5c153d29
|
@ -10,6 +10,7 @@ import warnings
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import py
|
import py
|
||||||
|
import six
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from .pathlib import ensure_reset_dir
|
from .pathlib import ensure_reset_dir
|
||||||
|
@ -28,8 +29,11 @@ class TempPathFactory(object):
|
||||||
|
|
||||||
_given_basetemp = attr.ib(
|
_given_basetemp = attr.ib(
|
||||||
# using os.path.abspath() to get absolute path instead of resolve() as it
|
# using os.path.abspath() to get absolute path instead of resolve() as it
|
||||||
# does not work the same in all platforms
|
# does not work the same in all platforms; there's Path.absolute(), but it is not
|
||||||
convert=attr.converters.optional(lambda p: Path(os.path.abspath(p)))
|
# public (see https://bugs.python.org/issue25012)
|
||||||
|
convert=attr.converters.optional(
|
||||||
|
lambda p: Path(os.path.abspath(six.text_type(p)))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
_trace = attr.ib()
|
_trace = attr.ib()
|
||||||
_basetemp = attr.ib(default=None)
|
_basetemp = attr.ib(default=None)
|
||||||
|
|
Loading…
Reference in New Issue