Skip to content

Commit 4353e02

Browse files
mgornypradyunsg
authored andcommitted
Use --no-build-isolation in tests to avoid using Internet
Add `--no-build-isolation` to the pip invocation in `pip_editable_parts` fixture and a few tests, to avoid downloading `setuptools` wheel from PyPI. This change makes it possible again to run the vast majority of pip tests (with the exception of 3 tests) offline. Fixes #12786.
1 parent 300ed75 commit 4353e02

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def pip_editable_parts(
395395
"-m",
396396
"pip",
397397
"install",
398+
"--no-build-isolation",
398399
"--target",
399400
pip_self_install_path,
400401
"-e",

tests/functional/test_config_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ def test_config_settings_implies_pep517(
118118
)
119119
result = script.pip(
120120
"wheel",
121+
"--no-build-isolation",
121122
"--config-settings",
122123
"FOO=Hello",
123124
pkg_path,

tests/functional/test_install.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,9 @@ def test_link_hash_in_dep_fails_require_hashes(
685685
# Build a wheel for pkga and compute its hash.
686686
wheelhouse = tmp_path / "wheehouse"
687687
wheelhouse.mkdir()
688-
script.pip("wheel", "--no-deps", "-w", wheelhouse, project_path)
688+
script.pip(
689+
"wheel", "--no-build-isolation", "--no-deps", "-w", wheelhouse, project_path
690+
)
689691
digest = hashlib.sha256(
690692
wheelhouse.joinpath("pkga-1.0-py3-none-any.whl").read_bytes()
691693
).hexdigest()
@@ -903,7 +905,14 @@ def test_editable_install__local_dir_setup_requires_with_pyproject(
903905
"setup(name='dummy', setup_requires=['simplewheel'])\n"
904906
)
905907

906-
script.pip("install", "--find-links", shared_data.find_links, "-e", local_dir)
908+
script.pip(
909+
"install",
910+
"--no-build-isolation",
911+
"--find-links",
912+
shared_data.find_links,
913+
"-e",
914+
local_dir,
915+
)
907916

908917

909918
def test_install_pre__setup_requires_with_pyproject(

tests/functional/test_self_update.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ def test_self_update_editable(script: Any, pip_src: Any) -> None:
1111
# Step 1. Install pip as non-editable. This is expected to succeed as
1212
# the existing pip in the environment is installed in editable mode, so
1313
# it only places a .pth file in the environment.
14-
proc = script.pip("install", pip_src)
14+
proc = script.pip("install", "--no-build-isolation", pip_src)
1515
assert proc.returncode == 0
1616
# Step 2. Using the pip we just installed, install pip *again*, but
1717
# in editable mode. This could fail, as we'll need to uninstall the running
1818
# pip in order to install the new copy, and uninstalling pip while it's
1919
# running could fail. This test is specifically to ensure that doesn't
2020
# happen...
21-
proc = script.pip("install", "-e", pip_src)
21+
proc = script.pip("install", "--no-build-isolation", "-e", pip_src)
2222
assert proc.returncode == 0

0 commit comments

Comments
 (0)