Skip to content

Commit

Permalink
fix test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Sep 3, 2023
1 parent 5463825 commit 0f20f62
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
11 changes: 5 additions & 6 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,18 +564,17 @@ def _complete_partial_requirements(
links_to_fully_download: Dict[Link, InstallRequirement] = {}
for req in partially_downloaded_reqs:
assert req.link
# (1) File URLs don't need to be downloaded, so skip them.
if req.link.scheme == "file":
continue
# (2) If this is e.g. a git url, we don't know how to handle that in the
# If this is e.g. a git url, we don't know how to handle that in the
# BatchDownloader, so leave it for self._prepare_linked_requirement() at the
# end of this method, which knows how to handle any URL.
can_simply_download = True
try:
# This will raise InvalidSchema if our Session can't download it.
self._session.get_adapter(req.link.url)
links_to_fully_download[req.link] = req
except InvalidSchema:
pass
can_simply_download = False
if can_simply_download:
links_to_fully_download[req.link] = req

batch_download = self._batch_download(
links_to_fully_download.keys(),
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_check_complicated_name_missing(script: PipTestEnvironment) -> None:

# Without dependency
result = script.pip("install", "--no-index", package_a_path, "--no-deps")
assert "Successfully installed package-A-1.0" in result.stdout, str(result)
assert "Successfully installed package-a-1.0" in result.stdout, str(result)

result = script.pip("check", expect_error=True)
expected_lines = ("package-a 1.0 requires dependency-b, which is not installed.",)
Expand All @@ -142,7 +142,7 @@ def test_check_complicated_name_broken(script: PipTestEnvironment) -> None:

# With broken dependency
result = script.pip("install", "--no-index", package_a_path, "--no-deps")
assert "Successfully installed package-A-1.0" in result.stdout, str(result)
assert "Successfully installed package-a-1.0" in result.stdout, str(result)

result = script.pip(
"install",
Expand Down Expand Up @@ -175,7 +175,7 @@ def test_check_complicated_name_clean(script: PipTestEnvironment) -> None:
)

result = script.pip("install", "--no-index", package_a_path, "--no-deps")
assert "Successfully installed package-A-1.0" in result.stdout, str(result)
assert "Successfully installed package-a-1.0" in result.stdout, str(result)

result = script.pip(
"install",
Expand Down Expand Up @@ -203,7 +203,7 @@ def test_check_considers_conditional_reqs(script: PipTestEnvironment) -> None:
)

result = script.pip("install", "--no-index", package_a_path, "--no-deps")
assert "Successfully installed package-A-1.0" in result.stdout, str(result)
assert "Successfully installed package-a-1.0" in result.stdout, str(result)

result = script.pip("check", expect_error=True)
expected_lines = ("package-a 1.0 requires dependency-b, which is not installed.",)
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -2071,7 +2071,7 @@ def test_install_conflict_results_in_warning(

# Install pkgA without its dependency
result1 = script.pip("install", "--no-index", pkgA_path, "--no-deps")
assert "Successfully installed pkgA-1.0" in result1.stdout, str(result1)
assert "Successfully installed pkga-1.0" in result1.stdout, str(result1)

# Then install an incorrect version of the dependency
result2 = script.pip(
Expand All @@ -2081,7 +2081,7 @@ def test_install_conflict_results_in_warning(
allow_stderr_error=True,
)
assert "pkga 1.0 requires pkgb==1.0" in result2.stderr, str(result2)
assert "Successfully installed pkgB-2.0" in result2.stdout, str(result2)
assert "Successfully installed pkgb-2.0" in result2.stdout, str(result2)


def test_install_conflict_warning_can_be_suppressed(
Expand All @@ -2101,11 +2101,11 @@ def test_install_conflict_warning_can_be_suppressed(

# Install pkgA without its dependency
result1 = script.pip("install", "--no-index", pkgA_path, "--no-deps")
assert "Successfully installed pkgA-1.0" in result1.stdout, str(result1)
assert "Successfully installed pkga-1.0" in result1.stdout, str(result1)

# Then install an incorrect version of the dependency; suppressing warning
result2 = script.pip("install", "--no-index", pkgB_path, "--no-warn-conflicts")
assert "Successfully installed pkgB-2.0" in result2.stdout, str(result2)
assert "Successfully installed pkgb-2.0" in result2.stdout, str(result2)


def test_target_install_ignores_distutils_config_install_prefix(
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_install_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_check_install_canonicalization(script: PipTestEnvironment) -> None:

# Let's install pkgA without its dependency
result = script.pip("install", "--no-index", pkga_path, "--no-deps")
assert "Successfully installed pkgA-1.0" in result.stdout, str(result)
assert "Successfully installed pkga-1.0" in result.stdout, str(result)

# Install the first missing dependency. Only an error for the
# second dependency should remain.
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def test_install_distribution_full_union(
result = script.pip_install_local(
to_install, f"{to_install}[bar]", f"{to_install}[baz]"
)
assert "Building wheel for LocalExtras" in result.stdout
assert "Building wheel for localextras" in result.stdout
result.did_create(script.site_packages / "simple")
result.did_create(script.site_packages / "singlemodule.py")

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def test_wheel_package_with_latin1_setup(

pkg_to_wheel = data.packages.joinpath("SetupPyLatin1")
result = script.pip("wheel", pkg_to_wheel)
assert "Successfully built SetupPyUTF8" in result.stdout
assert "Successfully built setuppyutf8" in result.stdout


def test_pip_wheel_with_pep518_build_reqs(
Expand Down

0 comments on commit 0f20f62

Please sign in to comment.