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.
Previously, when only 1 resolve target was specified, a `--pip-log` would be re-used which would append the current Pip log outout with the prior output. For a normal PEX build, this was potentially confusing, but for a `pex3 lock` command it could lead to errors since the log is used to generate the lock. Fixes pex-tool#2568
- Loading branch information
Showing
2 changed files
with
51 additions
and
4 deletions.
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,43 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import | ||
|
||
import re | ||
from textwrap import dedent | ||
|
||
from pex import targets | ||
from testing.cli import run_pex3 | ||
from testing.pytest.tmp import Tempdir | ||
|
||
|
||
def test_independent_logs_for_independent_runs(tmpdir): | ||
# type: (Tempdir) -> None | ||
|
||
lock = tmpdir.join("lock.json") | ||
log = tmpdir.join("pip.log") | ||
run_pex3( | ||
"lock", "sync", "--lock", lock, "--pip-log", log, "ansicolors==1.1.8", "cowsay==6.0" | ||
).assert_success() | ||
target = str(targets.current().platform.tag) | ||
run_pex3("lock", "sync", "--lock", lock, "--pip-log", log, "ansicolors==1.1.8").assert_success( | ||
expected_error_re=r".*{footer}$".format( | ||
footer=re.escape( | ||
dedent( | ||
"""\ | ||
Updates for lock generated by {target}: | ||
Deleted cowsay 6 | ||
Updates to lock input requirements: | ||
Deleted 'cowsay==6.0' | ||
""" | ||
).format(target=target) | ||
) | ||
), | ||
re_flags=re.DOTALL, | ||
) | ||
run_pex3("lock", "sync", "--lock", lock, "--pip-log", log, "ansicolors==1.1.8").assert_success( | ||
expected_error_re=r".*No updates for lock generated by {target}\.$".format( | ||
target=re.escape(target) | ||
), | ||
re_flags=re.DOTALL, | ||
) |