Skip to content

Commit 19e9a7e

Browse files
authored
Merge branch 'main' into dependency-resolution-grammar-fix
2 parents ca35f8a + 0235025 commit 19e9a7e

File tree

9 files changed

+66
-17
lines changed

9 files changed

+66
-17
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ on:
1111
schedule:
1212
- cron: 0 0 * * MON # Run every Monday at 00:00 UTC
1313

14+
env:
15+
# The "FORCE_COLOR" variable, when set to 1,
16+
# tells Nox to colorize itself.
17+
FORCE_COLOR: "1"
18+
1419
concurrency:
1520
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1621
cancel-in-progress: true
@@ -119,7 +124,9 @@ jobs:
119124

120125
- name: Install Ubuntu dependencies
121126
if: matrix.os == 'Ubuntu'
122-
run: sudo apt-get install bzr
127+
run: |
128+
sudo apt-get update
129+
sudo apt-get install bzr
123130
124131
- name: Install MacOS dependencies
125132
if: matrix.os == 'MacOS'
@@ -219,7 +226,9 @@ jobs:
219226
python-version: "3.10"
220227

221228
- name: Install Ubuntu dependencies
222-
run: sudo apt-get install bzr
229+
run: |
230+
sudo apt-get update
231+
sudo apt-get install bzr
223232
224233
- run: pip install nox 'virtualenv<20' 'setuptools != 60.6.0'
225234

news/12545.trivial.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This change will use ``build`` to create the ``pip`` sdist for testing.
2+
3+
It will also remove a direct ``setup.py`` invocation to install ``pip`` in
4+
editable mode to run from tests.

news/12559.trivial.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix Ubuntu CI Tests

news/7ae28a10-04c4-4a1f-a276-4c9e04f2e0c1.trivial.rst

Whitespace-only changes.

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def test(session: nox.Session) -> None:
8989
shutil.rmtree(sdist_dir, ignore_errors=True)
9090

9191
# fmt: off
92-
session.install("setuptools")
92+
session.install("build")
9393
session.run(
94-
"python", "setup.py", "sdist", "--formats=zip", "--dist-dir", sdist_dir,
94+
"python", "-I", "-m", "build", "--sdist", "--outdir", sdist_dir,
9595
silent=True,
9696
)
9797
# fmt: on

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ template = "tools/news/template.rst"
8989

9090
# Grouping of entries, within our changelog
9191
type = [
92-
{ name = "Process", directory = "process", showcontent = true },
9392
{ name = "Deprecations and Removals", directory = "removal", showcontent = true },
9493
{ name = "Features", directory = "feature", showcontent = true },
9594
{ name = "Bug Fixes", directory = "bugfix", showcontent = true },
9695
{ name = "Vendored Libraries", directory = "vendor", showcontent = true },
9796
{ name = "Improved Documentation", directory = "doc", showcontent = true },
97+
{ name = "Process", directory = "process", showcontent = true },
9898
{ name = "Trivial Changes", directory = "trivial", showcontent = false },
9999
]
100100

src/pip/_internal/resolution/resolvelib/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ def describe_trigger(parent: Candidate) -> str:
799799
+ "\n\n"
800800
+ "To fix this you could try to:\n"
801801
+ "1. loosen the range of package versions you've specified\n"
802-
+ "2. remove package versions to allow pip attempt to solve "
802+
+ "2. remove package versions to allow pip to attempt to solve "
803803
+ "the dependency conflict\n"
804804
)
805805

tests/conftest.py

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ def isolate(tmpdir: Path, monkeypatch: pytest.MonkeyPatch) -> None:
318318
# Make sure tests don't share a requirements tracker.
319319
monkeypatch.delenv("PIP_BUILD_TRACKER", False)
320320

321+
# Make sure color control variables don't affect internal output.
322+
monkeypatch.delenv("FORCE_COLOR", False)
323+
monkeypatch.delenv("NO_COLOR", False)
324+
321325
# FIXME: Windows...
322326
os.makedirs(os.path.join(home_dir, ".config", "git"))
323327
with open(os.path.join(home_dir, ".config", "git", "config"), "wb") as fp:
@@ -372,6 +376,36 @@ def not_code_files_and_folders(path: str, names: List[str]) -> Iterable[str]:
372376
return pip_src
373377

374378

379+
@pytest.fixture(scope="session")
380+
def pip_editable_parts(
381+
pip_src: Path, tmpdir_factory: pytest.TempPathFactory
382+
) -> Tuple[Path, ...]:
383+
pip_editable = tmpdir_factory.mktemp("pip") / "pip"
384+
shutil.copytree(pip_src, pip_editable, symlinks=True)
385+
# noxfile.py is Python 3 only
386+
assert compileall.compile_dir(
387+
pip_editable,
388+
quiet=1,
389+
rx=re.compile("noxfile.py$"),
390+
)
391+
pip_self_install_path = tmpdir_factory.mktemp("pip_self_install")
392+
subprocess.check_call(
393+
[
394+
sys.executable,
395+
"-m",
396+
"pip",
397+
"install",
398+
"--target",
399+
pip_self_install_path,
400+
"-e",
401+
pip_editable,
402+
]
403+
)
404+
pth = next(pip_self_install_path.glob("*pip*.pth"))
405+
dist_info = next(pip_self_install_path.glob("*.dist-info"))
406+
return (pth, dist_info)
407+
408+
375409
def _common_wheel_editable_install(
376410
tmpdir_factory: pytest.TempPathFactory, common_wheels: Path, package: str
377411
) -> Path:
@@ -435,6 +469,7 @@ def virtualenv_template(
435469
request: pytest.FixtureRequest,
436470
tmpdir_factory: pytest.TempPathFactory,
437471
pip_src: Path,
472+
pip_editable_parts: Tuple[Path, ...],
438473
setuptools_install: Path,
439474
wheel_install: Path,
440475
coverage_install: Path,
@@ -452,17 +487,17 @@ def virtualenv_template(
452487
# Install setuptools, wheel and pip.
453488
install_pth_link(venv, "setuptools", setuptools_install)
454489
install_pth_link(venv, "wheel", wheel_install)
455-
pip_editable = tmpdir_factory.mktemp("pip") / "pip"
456-
shutil.copytree(pip_src, pip_editable, symlinks=True)
457-
# noxfile.py is Python 3 only
458-
assert compileall.compile_dir(
459-
str(pip_editable),
460-
quiet=1,
461-
rx=re.compile("noxfile.py$"),
462-
)
463-
subprocess.check_call(
464-
[os.fspath(venv.bin / "python"), "setup.py", "-q", "develop"], cwd=pip_editable
490+
491+
pth, dist_info = pip_editable_parts
492+
493+
shutil.copy(pth, venv.site)
494+
shutil.copytree(
495+
dist_info, venv.site / dist_info.name, dirs_exist_ok=True, symlinks=True
465496
)
497+
# Create placeholder ``easy-install.pth``, as several tests depend on its
498+
# existance. TODO: Ensure ``tests.lib.TestPipResult.files_updated`` correctly
499+
# detects changed files.
500+
venv.site.joinpath("easy-install.pth").touch()
466501

467502
# Install coverage and pth file for executing it in any spawned processes
468503
# in this virtual environment.

tests/functional/test_inspect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from tests.lib import PipTestEnvironment, ScriptFactory, TestData
66

77

8-
@pytest.fixture(scope="session")
8+
@pytest.fixture
99
def simple_script(
1010
tmpdir_factory: pytest.TempPathFactory,
1111
script_factory: ScriptFactory,

0 commit comments

Comments
 (0)