forked from pex-tool/pex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
pex --no-build --lock ...
. (pex-tool#2390)
Since pex-tool#2346 which was released in Pex 2.1.161, using `--no-build` with a `--lock` would fail fast even if the lock itself was created with `--no-build`, which should be compatible. Fixes pex-tool#2389
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
from pex.interpreter import PythonInterpreter | ||
from pex.typing import TYPE_CHECKING | ||
from testing import PY310, ensure_python_interpreter, run_pex_command | ||
from testing.cli import run_pex3 | ||
|
||
if TYPE_CHECKING: | ||
from typing import Any | ||
|
||
|
||
def test_lock_use_no_build_wheel(tmpdir): | ||
# type: (Any)-> None | ||
|
||
lock = os.path.join(str(tmpdir), "black.lock") | ||
run_pex3( | ||
"lock", | ||
"create", | ||
"black==22.8.0", | ||
"-o", | ||
lock, | ||
"--style", | ||
"universal", | ||
"--indent", | ||
"2", | ||
"--interpreter-constraint", | ||
"CPython==3.10.*", | ||
"--wheel", | ||
"--no-build", | ||
).assert_success() | ||
|
||
pex = os.path.join(str(tmpdir), "black.pex") | ||
python = sys.executable if sys.version_info[:2] == (3, 10) else ensure_python_interpreter(PY310) | ||
run_pex_command( | ||
args=[ | ||
"-o", | ||
pex, | ||
"--python", | ||
python, | ||
"-c", | ||
"black", | ||
"--lock", | ||
lock, | ||
"--wheel", | ||
"--no-build", | ||
] | ||
).assert_success() | ||
|
||
output = subprocess.check_output(args=[pex, "--version"]) | ||
assert ( | ||
"black.pex, 22.8.0 (compiled: {compiled})".format( | ||
compiled="no" if PythonInterpreter.from_binary(python).is_pypy else "yes" | ||
) | ||
in output.decode("utf-8").splitlines() | ||
) |