Rename tests.lib.path.Path.{abspath -> resolve()}

上级 732da2da
......@@ -190,7 +190,7 @@ def pip_src(tmpdir_factory):
# Copy over our source tree so that each use is self contained
shutil.copytree(
SRC_DIR,
pip_src.abspath,
pip_src.resolve(),
ignore=not_code_files_and_folders,
)
return pip_src
......@@ -222,7 +222,7 @@ def wheel_install(tmpdir_factory, common_wheels):
def install_egg_link(venv, project_name, egg_info_dir):
with open(venv.site / 'easy-install.pth', 'a') as fp:
fp.write(str(egg_info_dir.abspath) + '\n')
fp.write(str(egg_info_dir.resolve()) + '\n')
with open(venv.site / (project_name + '.egg-link'), 'w') as fp:
fp.write(str(egg_info_dir) + '\n.')
......
......@@ -456,14 +456,14 @@ def test_hashed_install_success(script, data, tmpdir):
"""
file_url = path_to_url(
(data.packages / 'simple-1.0.tar.gz').abspath)
(data.packages / 'simple-1.0.tar.gz').resolve())
with requirements_file(
'simple2==1.0 --hash=sha256:9336af72ca661e6336eb87bc7de3e8844d853e'
'3848c2b9bbd2e8bf01db88c2c7\n'
'{simple} --hash=sha256:393043e672415891885c9a2a0929b1af95fb866d6c'
'a016b42d2e6ce53619b653'.format(simple=file_url),
tmpdir) as reqs_file:
script.pip_install_local('-r', reqs_file.abspath, expect_error=False)
script.pip_install_local('-r', reqs_file.resolve(), expect_error=False)
def test_hashed_install_failure(script, tmpdir):
......@@ -478,7 +478,7 @@ def test_hashed_install_failure(script, tmpdir):
'c7de3e8844d853e3848c2b9bbd2e8bf01db88c2c\n',
tmpdir) as reqs_file:
result = script.pip_install_local('-r',
reqs_file.abspath,
reqs_file.resolve(),
expect_error=True)
assert len(result.files_created) == 0
......
......@@ -371,7 +371,7 @@ def test_double_install_spurious_hash_mismatch(
# Install a package (and build its wheel):
result = script.pip_install_local(
'--find-links', data.find_links,
'-r', reqs_file.abspath, expect_error=False)
'-r', reqs_file.resolve(), expect_error=False)
assert 'Successfully installed simple-1.0' in str(result)
# Uninstall it:
......@@ -381,7 +381,7 @@ def test_double_install_spurious_hash_mismatch(
# package should install happily.
result = script.pip_install_local(
'--find-links', data.find_links,
'-r', reqs_file.abspath, expect_error=False)
'-r', reqs_file.resolve(), expect_error=False)
assert 'Successfully installed simple-1.0' in str(result)
......
......@@ -28,8 +28,8 @@ if MYPY_CHECK_RUNNING:
from pip._internal.models.target_python import TargetPython
DATA_DIR = Path(__file__).parent.parent.joinpath("data").abspath
SRC_DIR = Path(__file__).abspath.parent.parent.parent
DATA_DIR = Path(__file__).parent.parent.joinpath("data").resolve()
SRC_DIR = Path(__file__).resolve().parent.parent.parent
pyversion = get_major_minor_version()
pyversion_tuple = sys.version_info
......@@ -65,7 +65,7 @@ def _test_path_to_file_url(path):
Args:
path: a tests.lib.path.Path object.
"""
return 'file://' + path.abspath.replace('\\', '/')
return 'file://' + path.resolve().replace('\\', '/')
def create_file(path, contents=None):
......@@ -155,7 +155,7 @@ class TestData(object):
def __init__(self, root, source=None):
self.source = source or DATA_DIR
self.root = Path(root).abspath
self.root = Path(root).resolve()
@classmethod
def copy(cls, root):
......
......@@ -107,8 +107,7 @@ class Path(_base):
"""
return Path(os.path.splitext(self)[1])
@property
def abspath(self):
def resolve(self):
"""
'./a/bc.d' -> '/home/a/bc.d'
"""
......
......@@ -270,7 +270,7 @@ class TestRequirementSet(object):
def test_hash_mismatch(self, data):
"""A hash mismatch should raise an error."""
file_url = path_to_url(
(data.packages / 'simple-1.0.tar.gz').abspath)
(data.packages / 'simple-1.0.tar.gz').resolve())
reqset = RequirementSet(require_hashes=True)
reqset.add_requirement(get_processed_req_from_line(
'%s --hash=sha256:badbad' % file_url, lineno=1,
......
......@@ -677,7 +677,7 @@ class TestParseRequirements(object):
'''.format(global_option=global_option, install_option=install_option)
with requirements_file(content, tmpdir) as reqs_file:
req = next(parse_requirements(reqs_file.abspath,
req = next(parse_requirements(reqs_file.resolve(),
finder=finder,
options=options,
session=session))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册