Skip to content

Commit 48da366

Browse files
authored
Fix old-new value on recreate cache miss-match are swapped (#2212)
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 957a280 commit 48da366

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/asottile/pyupgrade
15-
rev: v2.25.0
15+
rev: v2.25.1
1616
hooks:
1717
- id: pyupgrade
1818
args: ["--py36-plus"]

docs/changelog/2211.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix old-new value on recreate cache miss-match are swapped -- by :user:`gaborbernat`.

src/tox/pytest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,11 @@ def empty_project(tox_project: ToxProjectCreator, monkeypatch: MonkeyPatch) -> T
398398
return project
399399

400400

401+
_RUN_INTEGRATION_TEST_FLAG = "--run-integration"
402+
403+
401404
def pytest_addoption(parser: Parser) -> None:
402-
parser.addoption("--run-integration", action="store_true", help="run the integration tests")
405+
parser.addoption(_RUN_INTEGRATION_TEST_FLAG, action="store_true", help="run the integration tests")
403406

404407

405408
def pytest_configure(config: PyTestConfig) -> None:
@@ -413,12 +416,12 @@ def pytest_collection_modifyitems(config: PyTestConfig, items: List[Function]) -
413416
if len(items) == 1: # pragma: no cover # hard to test
414417
return
415418

416-
skip_int = pytest.mark.skip(reason="integration tests not run (no --run-int flag)")
419+
skip_int = pytest.mark.skip(reason=f"integration tests not run (no {_RUN_INTEGRATION_TEST_FLAG} flag)")
417420

418421
def is_integration(test_item: Function) -> bool:
419422
return test_item.get_closest_marker("integration") is not None
420423

421-
integration_enabled = config.getoption("--run-integration")
424+
integration_enabled = config.getoption(_RUN_INTEGRATION_TEST_FLAG)
422425
if not integration_enabled: # pragma: no cover # hard to test
423426
for item in items:
424427
if is_integration(item):

src/tox/tox_env/python/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _diff_msg(conf: Dict[str, Any], old: Dict[str, Any]) -> str:
173173
removed = [f"{k}={v!r}" for k, v in old.items() if k not in conf]
174174
if removed:
175175
result.append(f"removed {' | '.join(removed)}")
176-
changed = [f"{k}={v!r}->{old[k]!r}" for k, v in conf.items() if k in old and v != old[k]]
176+
changed = [f"{k}={old[k]!r}->{v!r}" for k, v in conf.items() if k in old and v != old[k]]
177177
if changed:
178178
result.append(f"changed {' | '.join(changed)}")
179179
return f'python {", ".join(result)}'

tests/tox_env/python/test_python_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_build_wheel_in_non_base_pkg_env(
6060
def test_diff_msg_added_removed_changed() -> None:
6161
before = {"A": "1", "F": "8", "C": "3", "D": "4", "E": "6"}
6262
after = {"G": "9", "B": "2", "C": "3", "D": "5", "E": "7"}
63-
expected = "python added A='1' | F='8', removed G='9' | B='2', changed D='4'->'5' | E='6'->'7'"
63+
expected = "python added A='1' | F='8', removed G='9' | B='2', changed D='5'->'4' | E='7'->'6'"
6464
assert Python._diff_msg(before, after) == expected
6565

6666

tests/tox_env/python/virtual_env/test_virtualenv_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def test_recreate_when_virtualenv_changes(tox_project: ToxProjectCreator, mocker
119119

120120
mocker.patch.object(api, "virtualenv_version", "1.0")
121121
result = proj.run("r")
122-
assert f"recreate env because python changed virtualenv version='1.0'->'{virtualenv_version}'" in result.out
122+
assert f"recreate env because python changed virtualenv version='{virtualenv_version}'->'1.0'" in result.out
123123
assert "remove tox env folder" in result.out
124124

125125

0 commit comments

Comments
 (0)