summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorq0w <43147888+q0w@users.noreply.github.com>2023-04-09 18:12:41 +0300
committerq0w <43147888+q0w@users.noreply.github.com>2023-04-09 18:12:41 +0300
commit110a26f0edf0a016d7207abc94a18c1c8762053e (patch)
tree474a9964b82b4fdb5885053d0d3e443c746f2e15 /tests
parent0fbca36516ed9839da9e64ea9bd05518ed83b967 (diff)
parent7cb863e2fcb1152f3a2160df3c3581a5e4be1ff0 (diff)
downloadpip-110a26f0edf0a016d7207abc94a18c1c8762053e.tar.gz
Merge branch 'main' into per-req-config-settings
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/test_config_settings.py161
-rw-r--r--tests/functional/test_install.py71
-rw-r--r--tests/functional/test_install_reqs.py3
-rw-r--r--tests/functional/test_install_vcs_git.py2
-rw-r--r--tests/functional/test_show.py28
-rw-r--r--tests/unit/test_cache.py11
-rw-r--r--tests/unit/test_req.py5
-rw-r--r--tests/unit/test_req_file.py13
8 files changed, 188 insertions, 106 deletions
diff --git a/tests/functional/test_config_settings.py b/tests/functional/test_config_settings.py
index 35b506a6b..f3975de2a 100644
--- a/tests/functional/test_config_settings.py
+++ b/tests/functional/test_config_settings.py
@@ -1,8 +1,10 @@
import json
+import tarfile
from pathlib import Path
-from typing import Tuple
+from typing import List, Optional, Tuple
from zipfile import ZipFile
+from pip._internal.utils.urls import path_to_url
from tests.lib import PipTestEnvironment, create_basic_sdist_for_package
PYPROJECT_TOML = """\
@@ -36,9 +38,10 @@ Summary: A dummy package
Author: None
Author-email: none@example.org
License: MIT
+{requires_dist}
"""
-def make_wheel(z, project, version, files):
+def make_wheel(z, project, version, requires_dist, files):
record = []
def add_file(name, data):
data = data.encode("utf-8")
@@ -48,7 +51,9 @@ def make_wheel(z, project, version, files):
record.append((name, f"sha256={hash}", len(data)))
distinfo = f"{project}-{version}.dist-info"
add_file(f"{distinfo}/WHEEL", WHEEL)
- add_file(f"{distinfo}/METADATA", METADATA.format(project=project, version=version))
+ add_file(f"{distinfo}/METADATA", METADATA.format(
+ project=project, version=version, requires_dist=requires_dist
+ ))
for name, data in files:
add_file(name, data)
record_name = f"{distinfo}/RECORD"
@@ -70,14 +75,14 @@ class Backend:
):
if config_settings is None:
config_settings = {}
- w = os.path.join(wheel_directory, "foo-1.0-py3-none-any.whl")
+ w = os.path.join(wheel_directory, "{{name}}-1.0-py3-none-any.whl")
with open(w, "wb") as f:
with ZipFile(f, "w") as z:
make_wheel(
- z, "foo", "1.0",
- [("config.json", json.dumps(config_settings))]
+ z, "{{name}}", "1.0", "{{requires_dist}}",
+ [("{{name}}-config.json", json.dumps(config_settings))]
)
- return "foo-1.0-py3-none-any.whl"
+ return "{{name}}-1.0-py3-none-any.whl"
build_editable = build_wheel
@@ -85,14 +90,20 @@ main = Backend()
'''
-def make_project(path: Path) -> Tuple[str, str, Path]:
- name = "foo"
+def make_project(
+ path: Path, name: str = "foo", dependencies: Optional[List[str]] = None
+) -> Tuple[str, str, Path]:
version = "1.0"
project_dir = path / name
backend = project_dir / "backend"
backend.mkdir(parents=True)
(project_dir / "pyproject.toml").write_text(PYPROJECT_TOML)
- (backend / "dummy_backend.py").write_text(BACKEND_SRC)
+ requires_dist = [f"Requires-Dist: {dep}" for dep in dependencies or []]
+ (backend / "dummy_backend.py").write_text(
+ BACKEND_SRC.replace("{{name}}", name).replace(
+ "{{requires_dist}}", "\n".join(requires_dist)
+ )
+ )
return name, version, project_dir
@@ -108,7 +119,7 @@ def test_backend_sees_config(script: PipTestEnvironment) -> None:
wheel_file_path = script.cwd / wheel_file_name
with open(wheel_file_path, "rb") as f:
with ZipFile(f) as z:
- output = z.read("config.json")
+ output = z.read(f"{name}-config.json")
assert json.loads(output) == {"FOO": "Hello"}
@@ -122,36 +133,144 @@ def test_backend_sees_config_reqs(script: PipTestEnvironment) -> None:
wheel_file_path = script.cwd / wheel_file_name
with open(wheel_file_path, "rb") as f:
with ZipFile(f) as z:
- output = z.read("config.json")
+ output = z.read(f"{name}-config.json")
+ assert json.loads(output) == {"FOO": "Hello"}
+
+
+def test_backend_sees_config_via_constraint(script: PipTestEnvironment) -> None:
+ name, version, project_dir = make_project(script.scratch_path)
+ constraints_file = script.scratch_path / "constraints.txt"
+ constraints_file.write_text(f"{name} @ {path_to_url(str(project_dir))}")
+ script.pip(
+ "wheel",
+ "--config-settings",
+ "FOO=Hello",
+ "-c",
+ "constraints.txt",
+ name,
+ )
+ wheel_file_name = f"{name}-{version}-py3-none-any.whl"
+ wheel_file_path = script.cwd / wheel_file_name
+ with open(wheel_file_path, "rb") as f:
+ with ZipFile(f) as z:
+ output = z.read(f"{name}-config.json")
+ assert json.loads(output) == {"FOO": "Hello"}
+
+
+def test_backend_sees_config_via_sdist(script: PipTestEnvironment) -> None:
+ name, version, project_dir = make_project(script.scratch_path)
+ dists_dir = script.scratch_path / "dists"
+ dists_dir.mkdir()
+ with tarfile.open(dists_dir / f"{name}-{version}.tar.gz", "w:gz") as dist_tar:
+ dist_tar.add(project_dir, arcname=name)
+ script.pip(
+ "wheel",
+ "--config-settings",
+ "FOO=Hello",
+ "-f",
+ dists_dir,
+ name,
+ )
+ wheel_file_name = f"{name}-{version}-py3-none-any.whl"
+ wheel_file_path = script.cwd / wheel_file_name
+ with open(wheel_file_path, "rb") as f:
+ with ZipFile(f) as z:
+ output = z.read(f"{name}-config.json")
assert json.loads(output) == {"FOO": "Hello"}
+def test_req_file_does_not_see_config(script: PipTestEnvironment) -> None:
+ """Test that CLI config settings do not propagate to requirement files."""
+ name, _, project_dir = make_project(script.scratch_path)
+ reqs_file = script.scratch_path / "reqs.txt"
+ reqs_file.write_text(f"{project_dir}")
+ script.pip(
+ "install",
+ "--config-settings",
+ "FOO=Hello",
+ "-r",
+ reqs_file,
+ )
+ config = script.site_packages_path / f"{name}-config.json"
+ with open(config, "rb") as f:
+ assert json.load(f) == {}
+
+
+def test_dep_does_not_see_config(script: PipTestEnvironment) -> None:
+ """Test that CLI config settings do not propagate to dependencies."""
+ _, _, bar_project_dir = make_project(script.scratch_path, name="bar")
+ _, _, foo_project_dir = make_project(
+ script.scratch_path,
+ name="foo",
+ dependencies=[f"bar @ {path_to_url(str(bar_project_dir))}"],
+ )
+ script.pip(
+ "install",
+ "--config-settings",
+ "FOO=Hello",
+ foo_project_dir,
+ )
+ foo_config = script.site_packages_path / "foo-config.json"
+ with open(foo_config, "rb") as f:
+ assert json.load(f) == {"FOO": "Hello"}
+ bar_config = script.site_packages_path / "bar-config.json"
+ with open(bar_config, "rb") as f:
+ assert json.load(f) == {}
+
+
+def test_dep_in_req_file_does_not_see_config(script: PipTestEnvironment) -> None:
+ """Test that CLI config settings do not propagate to dependencies found in
+ requirement files."""
+ _, _, bar_project_dir = make_project(script.scratch_path, name="bar")
+ _, _, foo_project_dir = make_project(
+ script.scratch_path,
+ name="foo",
+ dependencies=["bar"],
+ )
+ reqs_file = script.scratch_path / "reqs.txt"
+ reqs_file.write_text(f"bar @ {path_to_url(str(bar_project_dir))}")
+ script.pip(
+ "install",
+ "--config-settings",
+ "FOO=Hello",
+ "-r",
+ reqs_file,
+ foo_project_dir,
+ )
+ foo_config = script.site_packages_path / "foo-config.json"
+ with open(foo_config, "rb") as f:
+ assert json.load(f) == {"FOO": "Hello"}
+ bar_config = script.site_packages_path / "bar-config.json"
+ with open(bar_config, "rb") as f:
+ assert json.load(f) == {}
+
+
def test_install_sees_config(script: PipTestEnvironment) -> None:
- _, _, project_dir = make_project(script.scratch_path)
+ name, _, project_dir = make_project(script.scratch_path)
script.pip(
"install",
"--config-settings",
"FOO=Hello",
project_dir,
)
- config = script.site_packages_path / "config.json"
+ config = script.site_packages_path / f"{name}-config.json"
with open(config, "rb") as f:
assert json.load(f) == {"FOO": "Hello"}
def test_install_sees_config_reqs(script: PipTestEnvironment) -> None:
- _, _, project_dir = make_project(script.scratch_path)
+ name, _, project_dir = make_project(script.scratch_path)
script.scratch_path.joinpath("reqs.txt").write_text(
f"{project_dir} --config-settings FOO=Hello"
)
script.pip("install", "-r", "reqs.txt")
- config = script.site_packages_path / "config.json"
+ config = script.site_packages_path / f"{name}-config.json"
with open(config, "rb") as f:
assert json.load(f) == {"FOO": "Hello"}
def test_install_editable_sees_config(script: PipTestEnvironment) -> None:
- _, _, project_dir = make_project(script.scratch_path)
+ name, _, project_dir = make_project(script.scratch_path)
script.pip(
"install",
"--config-settings",
@@ -159,13 +278,13 @@ def test_install_editable_sees_config(script: PipTestEnvironment) -> None:
"--editable",
project_dir,
)
- config = script.site_packages_path / "config.json"
+ config = script.site_packages_path / f"{name}-config.json"
with open(config, "rb") as f:
assert json.load(f) == {"FOO": "Hello"}
def test_install_config_reqs(script: PipTestEnvironment) -> None:
- _, _, project_dir = make_project(script.scratch_path)
+ name, _, project_dir = make_project(script.scratch_path)
a_sdist = create_basic_sdist_for_package(
script,
"foo",
@@ -173,12 +292,12 @@ def test_install_config_reqs(script: PipTestEnvironment) -> None:
{"pyproject.toml": PYPROJECT_TOML, "backend/dummy_backend.py": BACKEND_SRC},
)
script.scratch_path.joinpath("reqs.txt").write_text(
- 'foo --config-settings "--build-option=--cffi" '
+ f'{project_dir} --config-settings "--build-option=--cffi" '
'--config-settings "--build-option=--avx2" '
"--config-settings FOO=BAR"
)
script.pip("install", "--no-index", "-f", str(a_sdist.parent), "-r", "reqs.txt")
script.assert_installed(foo="1.0")
- config = script.site_packages_path / "config.json"
+ config = script.site_packages_path / f"{name}-config.json"
with open(config, "rb") as f:
assert json.load(f) == {"--build-option": ["--cffi", "--avx2"], "FOO": "BAR"}
diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py
index 16ef572b5..72c72f35c 100644
--- a/tests/functional/test_install.py
+++ b/tests/functional/test_install.py
@@ -829,7 +829,10 @@ def test_install_global_option(script: PipTestEnvironment) -> None:
(In particular those that disable the actual install action)
"""
result = script.pip(
- "install", "--global-option=--version", "INITools==0.1", expect_stderr=True
+ "install",
+ "--global-option=--version",
+ "INITools==0.1",
+ expect_error=True, # build is going to fail because of --version
)
assert "INITools==0.1\n" in result.stdout
assert not result.files_created
@@ -1157,7 +1160,6 @@ def test_install_package_with_prefix(
rel_prefix_path = script.scratch / "prefix"
install_path = join(
sysconfig.get_path("purelib", vars={"base": rel_prefix_path}),
- # we still test for egg-info because no-binary implies setup.py install
"simple-1.0.dist-info",
)
result.did_create(install_path)
@@ -1498,15 +1500,12 @@ def test_install_subprocess_output_handling(
# This error is emitted 3 times:
# - by setup.py bdist_wheel
# - by setup.py clean
- # - by setup.py install which is used as fallback when setup.py bdist_wheel failed
- # Before, it failed only once because it attempted only setup.py install.
- # TODO update this when we remove the last setup.py install code path.
- assert 3 == result.stderr.count("I DIE, I DIE")
+ assert 2 == result.stderr.count("I DIE, I DIE")
result = script.pip(
*(args + ["--global-option=--fail", "--verbose"]), expect_error=True
)
- assert 3 == result.stderr.count("I DIE, I DIE")
+ assert 2 == result.stderr.count("I DIE, I DIE")
def test_install_log(script: PipTestEnvironment, data: TestData, tmpdir: Path) -> None:
@@ -1526,22 +1525,9 @@ def test_install_topological_sort(script: PipTestEnvironment, data: TestData) ->
assert order1 in res or order2 in res, res
-def test_install_wheel_broken(script: PipTestEnvironment) -> None:
- res = script.pip_install_local("wheelbroken", allow_stderr_error=True)
- assert "ERROR: Failed building wheel for wheelbroken" in res.stderr
- # Fallback to setup.py install (https://github.com/pypa/pip/issues/8368)
- assert "Successfully installed wheelbroken-0.1" in str(res), str(res)
-
-
def test_cleanup_after_failed_wheel(script: PipTestEnvironment) -> None:
- res = script.pip_install_local("wheelbrokenafter", allow_stderr_error=True)
+ res = script.pip_install_local("wheelbrokenafter", expect_error=True)
assert "ERROR: Failed building wheel for wheelbrokenafter" in res.stderr
- # One of the effects of not cleaning up is broken scripts:
- script_py = script.bin_path / "script.py"
- assert script_py.exists(), script_py
- with open(script_py) as f:
- shebang = f.readline().strip()
- assert shebang != "#!python", shebang
# OK, assert that we *said* we were cleaning up:
# /!\ if in need to change this, also change test_pep517_no_legacy_cleanup
assert "Running setup.py clean for wheelbrokenafter" in str(res), str(res)
@@ -1568,38 +1554,26 @@ def test_install_builds_wheels(script: PipTestEnvironment, data: TestData) -> No
"-f",
data.find_links,
to_install,
- allow_stderr_error=True, # error building wheelbroken
- )
- expected = (
- "Successfully installed requires-wheelbroken-upper-0"
- " upper-2.0 wheelbroken-0.1"
+ expect_error=True, # error building wheelbroken
)
- # Must have installed it all
- assert expected in str(res), str(res)
wheels: List[str] = []
for _, _, files in os.walk(wheels_cache):
wheels.extend(f for f in files if f.endswith(".whl"))
- # and built wheels for upper and wheelbroken
+ # Built wheel for upper
assert "Building wheel for upper" in str(res), str(res)
+ # Built wheel for wheelbroken, but failed
assert "Building wheel for wheelb" in str(res), str(res)
+ assert "Failed to build wheelbroken" in str(res), str(res)
# Wheels are built for local directories, but not cached.
assert "Building wheel for requir" in str(res), str(res)
- # wheelbroken has to run install
# into the cache
assert wheels != [], str(res)
- # and installed from the wheel
- assert "Running setup.py install for upper" not in str(res), str(res)
- # Wheels are built for local directories, but not cached.
- assert "Running setup.py install for requir" not in str(res), str(res)
- # wheelbroken has to run install
- assert "Running setup.py install for wheelb" in str(res), str(res)
- # We want to make sure pure python wheels do not have an implementation tag
assert wheels == [
"Upper-2.0-py{}-none-any.whl".format(sys.version_info[0]),
]
-def test_install_no_binary_disables_building_wheels(
+def test_install_no_binary_builds_wheels(
script: PipTestEnvironment, data: TestData
) -> None:
to_install = data.packages.joinpath("requires_wheelbroken_upper")
@@ -1610,22 +1584,14 @@ def test_install_no_binary_disables_building_wheels(
"-f",
data.find_links,
to_install,
- allow_stderr_error=True, # error building wheelbroken
- )
- expected = (
- "Successfully installed requires-wheelbroken-upper-0"
- " upper-2.0 wheelbroken-0.1"
+ expect_error=True, # error building wheelbroken
)
- # Must have installed it all
- assert expected in str(res), str(res)
- # and built wheels for wheelbroken only
+ # Wheels are built for all requirements
assert "Building wheel for wheelb" in str(res), str(res)
- # Wheels are built for local directories, but not cached across runs
assert "Building wheel for requir" in str(res), str(res)
- # Don't build wheel for upper which was blacklisted
assert "Building wheel for upper" in str(res), str(res)
- # And these two fell back to sdist based installed.
- assert "Running setup.py install for wheelb" in str(res), str(res)
+ # Wheelbroken failed to build
+ assert "Failed to build wheelbroken" in str(res), str(res)
@pytest.mark.network
@@ -1639,7 +1605,6 @@ def test_install_no_binary_builds_pep_517_wheel(
assert expected in str(res), str(res)
assert "Building wheel for pep517-setup" in str(res), str(res)
- assert "Running setup.py install for pep517-set" not in str(res), str(res)
@pytest.mark.network
@@ -1656,7 +1621,7 @@ def test_install_no_binary_uses_local_backend(
assert os.path.isfile(marker), "Local PEP 517 backend not used"
-def test_install_no_binary_disables_cached_wheels(
+def test_install_no_binary_uses_cached_wheels(
script: PipTestEnvironment, data: TestData
) -> None:
# Seed the cache
@@ -1673,7 +1638,7 @@ def test_install_no_binary_disables_cached_wheels(
)
assert "Successfully installed upper-2.0" in str(res), str(res)
# upper is built and not obtained from cache
- assert "Building wheel for upper" in str(res), str(res)
+ assert "Building wheel for upper" not in str(res), str(res)
def test_install_editable_with_wrong_egg_name(
diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py
index 280424e7a..96cff0dc5 100644
--- a/tests/functional/test_install_reqs.py
+++ b/tests/functional/test_install_reqs.py
@@ -339,7 +339,6 @@ def test_wheel_user_with_prefix_in_pydistutils_cfg(
"install", "--user", "--no-index", "-f", data.find_links, "requiresupper"
)
# Check that we are really installing a wheel
- assert "Running setup.py install for requiresupper" not in result.stdout
assert "installed requiresupper" in result.stdout
@@ -661,7 +660,7 @@ def test_install_distribution_union_with_constraints(
msg = "Unnamed requirements are not allowed as constraints"
assert msg in result.stderr
else:
- assert "Running setup.py install for LocalExtras" in result.stdout
+ assert "Building wheel for LocalExtras" in result.stdout
result.did_create(script.site_packages / "singlemodule.py")
diff --git a/tests/functional/test_install_vcs_git.py b/tests/functional/test_install_vcs_git.py
index d7e8c2602..971526c51 100644
--- a/tests/functional/test_install_vcs_git.py
+++ b/tests/functional/test_install_vcs_git.py
@@ -392,7 +392,7 @@ def test_git_with_non_editable_unpacking(
)
result = script.pip(
"install",
- "--global-option=--version",
+ "--global-option=--quiet",
local_url,
allow_stderr_warning=True,
)
diff --git a/tests/functional/test_show.py b/tests/functional/test_show.py
index a7e9022a5..b8ec0510a 100644
--- a/tests/functional/test_show.py
+++ b/tests/functional/test_show.py
@@ -1,14 +1,17 @@
import os
import pathlib
import re
+import textwrap
from pip import __version__
from pip._internal.commands.show import search_packages_info
-from pip._internal.operations.install.legacy import (
- write_installed_files_from_setuptools_record,
-)
from pip._internal.utils.unpacking import untar_file
-from tests.lib import PipTestEnvironment, TestData, create_test_package_with_setup
+from tests.lib import (
+ PipTestEnvironment,
+ TestData,
+ create_test_package_with_setup,
+ pyversion,
+)
def test_basic_show(script: PipTestEnvironment) -> None:
@@ -77,10 +80,19 @@ def test_show_with_files_from_legacy(
str(setuptools_record),
cwd=source_dir,
)
- write_installed_files_from_setuptools_record(
- setuptools_record.read_text().splitlines(),
- root=None,
- req_description="simple==1.0",
+ # Emulate the installed-files.txt generation which previous pip version did
+ # after running setup.py install (write_installed_files_from_setuptools_record).
+ egg_info_dir = script.site_packages_path / f"simple-1.0-py{pyversion}.egg-info"
+ egg_info_dir.joinpath("installed-files.txt").write_text(
+ textwrap.dedent(
+ """\
+ ../simple/__init__.py
+ PKG-INFO
+ SOURCES.txt
+ dependency_links.txt
+ top_level.txt
+ """
+ )
)
result = script.pip("show", "--files", "simple")
diff --git a/tests/unit/test_cache.py b/tests/unit/test_cache.py
index f27daa266..d0fee69c3 100644
--- a/tests/unit/test_cache.py
+++ b/tests/unit/test_cache.py
@@ -4,13 +4,12 @@ from pathlib import Path
from pip._vendor.packaging.tags import Tag, interpreter_name, interpreter_version
from pip._internal.cache import WheelCache, _hash_dict
-from pip._internal.models.format_control import FormatControl
from pip._internal.models.link import Link
from pip._internal.utils.misc import ensure_dir
def test_falsey_path_none() -> None:
- wc = WheelCache("", FormatControl())
+ wc = WheelCache("")
assert wc.cache_dir is None
@@ -18,7 +17,7 @@ def test_subdirectory_fragment() -> None:
"""
Test the subdirectory URL fragment is part of the cache key.
"""
- wc = WheelCache("/tmp/.foo/", FormatControl())
+ wc = WheelCache("/tmp/.foo/")
link1 = Link("git+https://g.c/o/r#subdirectory=d1")
link2 = Link("git+https://g.c/o/r#subdirectory=d2")
assert wc.get_path_for_link(link1) != wc.get_path_for_link(link2)
@@ -29,7 +28,7 @@ def test_wheel_name_filter(tmpdir: Path) -> None:
Test the wheel cache filters on wheel name when several wheels
for different package are stored under the same cache directory.
"""
- wc = WheelCache(os.fspath(tmpdir), FormatControl())
+ wc = WheelCache(os.fspath(tmpdir))
link = Link("https://g.c/package.tar.gz")
cache_path = wc.get_path_for_link(link)
ensure_dir(cache_path)
@@ -57,7 +56,7 @@ def test_link_to_cache(tmpdir: Path) -> None:
Test that Link.from_json() produces Links with consistent cache
locations
"""
- wc = WheelCache(os.fspath(tmpdir), FormatControl())
+ wc = WheelCache(os.fspath(tmpdir))
# Define our expectations for stable cache path.
i_name = interpreter_name()
i_version = interpreter_version()
@@ -95,7 +94,7 @@ def test_link_to_cache(tmpdir: Path) -> None:
def test_get_cache_entry(tmpdir: Path) -> None:
- wc = WheelCache(os.fspath(tmpdir), FormatControl())
+ wc = WheelCache(os.fspath(tmpdir))
persi_link = Link("https://g.c/o/r/persi")
persi_path = wc.get_path_for_link(persi_link)
ensure_dir(persi_path)
diff --git a/tests/unit/test_req.py b/tests/unit/test_req.py
index c46883dc2..a5286c13a 100644
--- a/tests/unit/test_req.py
+++ b/tests/unit/test_req.py
@@ -25,7 +25,6 @@ from pip._internal.exceptions import (
from pip._internal.index.package_finder import PackageFinder
from pip._internal.metadata import select_backend
from pip._internal.models.direct_url import ArchiveInfo, DirectUrl, DirInfo, VcsInfo
-from pip._internal.models.format_control import FormatControl
from pip._internal.models.link import Link
from pip._internal.network.session import PipSession
from pip._internal.operations.build.build_tracker import get_build_tracker
@@ -403,7 +402,7 @@ class TestRequirementSet:
"""Test download_info hash is not set for an archive with legacy cache entry."""
url = shared_data.packages.joinpath("simple-1.0.tar.gz").as_uri()
finder = make_test_finder()
- wheel_cache = WheelCache(str(tmp_path / "cache"), FormatControl())
+ wheel_cache = WheelCache(str(tmp_path / "cache"))
cache_entry_dir = wheel_cache.get_path_for_link(Link(url))
Path(cache_entry_dir).mkdir(parents=True)
wheel.make_wheel(name="simple", version="1.0").save_to_dir(cache_entry_dir)
@@ -426,7 +425,7 @@ class TestRequirementSet:
url = shared_data.packages.joinpath("simple-1.0.tar.gz").as_uri()
hash = "sha256=ad977496000576e1b6c41f6449a9897087ce9da6db4f15b603fe8372af4bf3c6"
finder = make_test_finder()
- wheel_cache = WheelCache(str(tmp_path / "cache"), FormatControl())
+ wheel_cache = WheelCache(str(tmp_path / "cache"))
cache_entry_dir = wheel_cache.get_path_for_link(Link(url))
Path(cache_entry_dir).mkdir(parents=True)
Path(cache_entry_dir).joinpath("origin.json").write_text(
diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py
index c105e07cc..439c41563 100644
--- a/tests/unit/test_req_file.py
+++ b/tests/unit/test_req_file.py
@@ -1,7 +1,6 @@
import collections
import logging
import os
-import subprocess
import textwrap
from optparse import Values
from pathlib import Path
@@ -890,14 +889,4 @@ class TestParseRequirements:
)
)
- req.source_dir = os.curdir
- with mock.patch.object(subprocess, "Popen") as popen:
- popen.return_value.stdout.readline.return_value = b""
- try:
- req.install([])
- except Exception:
- pass
-
- last_call = popen.call_args_list[-1]
- args = last_call[0][0]
- assert 0 < args.index(global_option) < args.index("install")
+ assert req.global_options == [global_option]