Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.25.0
rev: v2.25.1
hooks:
- id: pyupgrade
args: ["--py36-plus"]
Expand Down
1 change: 1 addition & 0 deletions docs/changelog/2211.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix old-new value on recreate cache miss-match are swapped -- by :user:`gaborbernat`.
9 changes: 6 additions & 3 deletions src/tox/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,11 @@ def empty_project(tox_project: ToxProjectCreator, monkeypatch: MonkeyPatch) -> T
return project


_RUN_INTEGRATION_TEST_FLAG = "--run-integration"


def pytest_addoption(parser: Parser) -> None:
parser.addoption("--run-integration", action="store_true", help="run the integration tests")
parser.addoption(_RUN_INTEGRATION_TEST_FLAG, action="store_true", help="run the integration tests")


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

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

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

integration_enabled = config.getoption("--run-integration")
integration_enabled = config.getoption(_RUN_INTEGRATION_TEST_FLAG)
if not integration_enabled: # pragma: no cover # hard to test
for item in items:
if is_integration(item):
Expand Down
2 changes: 1 addition & 1 deletion src/tox/tox_env/python/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _diff_msg(conf: Dict[str, Any], old: Dict[str, Any]) -> str:
removed = [f"{k}={v!r}" for k, v in old.items() if k not in conf]
if removed:
result.append(f"removed {' | '.join(removed)}")
changed = [f"{k}={v!r}->{old[k]!r}" for k, v in conf.items() if k in old and v != old[k]]
changed = [f"{k}={old[k]!r}->{v!r}" for k, v in conf.items() if k in old and v != old[k]]
if changed:
result.append(f"changed {' | '.join(changed)}")
return f'python {", ".join(result)}'
Expand Down
2 changes: 1 addition & 1 deletion tests/tox_env/python/test_python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_build_wheel_in_non_base_pkg_env(
def test_diff_msg_added_removed_changed() -> None:
before = {"A": "1", "F": "8", "C": "3", "D": "4", "E": "6"}
after = {"G": "9", "B": "2", "C": "3", "D": "5", "E": "7"}
expected = "python added A='1' | F='8', removed G='9' | B='2', changed D='4'->'5' | E='6'->'7'"
expected = "python added A='1' | F='8', removed G='9' | B='2', changed D='5'->'4' | E='7'->'6'"
assert Python._diff_msg(before, after) == expected


Expand Down
2 changes: 1 addition & 1 deletion tests/tox_env/python/virtual_env/test_virtualenv_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_recreate_when_virtualenv_changes(tox_project: ToxProjectCreator, mocker

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


Expand Down