Skip to content

Commit 5ad66c1

Browse files
fix legacy tox --devenv venv (#3013)
Co-authored-by: Bernát Gábor <[email protected]>
1 parent 3238abf commit 5ad66c1

File tree

6 files changed

+39
-23
lines changed

6 files changed

+39
-23
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ repos:
1717
- id: add-trailing-comma
1818
args: [--py36-plus]
1919
- repo: https://github.com/asottile/pyupgrade
20-
rev: v3.3.1
20+
rev: v3.4.0
2121
hooks:
2222
- id: pyupgrade
2323
args: ["--py37-plus"]
@@ -52,7 +52,7 @@ repos:
5252
hooks:
5353
- id: flake8
5454
additional_dependencies:
55-
- flake8-bugbear==23.3.23
55+
- flake8-bugbear==23.5.9
5656
- flake8-comprehensions==3.12
5757
- flake8-pytest-style==1.7.2
5858
- flake8-spellcheck==0.28
@@ -69,7 +69,7 @@ repos:
6969
- "@prettier/[email protected]"
7070
args: ["--print-width=120", "--prose-wrap=always"]
7171
- repo: https://github.com/igorshubovych/markdownlint-cli
72-
rev: v0.33.0
72+
rev: v0.34.0
7373
hooks:
7474
- id: markdownlint
7575
- repo: local

docs/changelog/2925.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``tox --devenv venv`` invocation without ``-e`` - by :user:`asottile`.

pyproject.toml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
build-backend = "hatchling.build"
33
requires = [
44
"hatch-vcs>=0.3",
5-
"hatchling>=1.14",
5+
"hatchling>=1.17",
66
]
77

88
[project]
@@ -51,23 +51,23 @@ dependencies = [
5151
"cachetools>=5.3",
5252
"chardet>=5.1",
5353
"colorama>=0.4.6",
54-
"filelock>=3.11",
55-
'importlib-metadata>=6.4.1; python_version < "3.8"',
54+
"filelock>=3.12",
55+
'importlib-metadata>=6.6; python_version < "3.8"',
5656
"packaging>=23.1",
57-
"platformdirs>=3.2",
57+
"platformdirs>=3.5.1",
5858
"pluggy>=1",
5959
"pyproject-api>=1.5.1",
6060
'tomli>=2.0.1; python_version < "3.11"',
61-
'typing-extensions>=4.5; python_version < "3.8"',
62-
"virtualenv>=20.21",
61+
'typing-extensions>=4.6.2; python_version < "3.8"',
62+
"virtualenv>=20.23",
6363
]
6464
optional-dependencies.docs = [
65-
"furo>=2023.3.27",
66-
"sphinx>=6.1.3",
65+
"furo>=2023.5.20",
66+
"sphinx>=7.0.1",
6767
"sphinx-argparse-cli>=1.11",
6868
"sphinx-autodoc-typehints!=1.23.4,>=1.23",
6969
"sphinx-copybutton>=0.5.2",
70-
"sphinx-inline-tabs>=2022.1.2b11",
70+
"sphinx-inline-tabs>=2023.4.21",
7171
"sphinxcontrib-towncrier>=0.2.1a0",
7272
"towncrier>=22.12",
7373
]
@@ -79,12 +79,12 @@ optional-dependencies.testing = [
7979
"distlib>=0.3.6",
8080
"flaky>=3.7",
8181
"hatch-vcs>=0.3",
82-
"hatchling>=1.14",
83-
"psutil>=5.9.4",
82+
"hatchling>=1.17",
83+
"psutil>=5.9.5",
8484
"pytest>=7.3.1",
85-
"pytest-cov>=4",
85+
"pytest-cov>=4.1",
8686
"pytest-mock>=3.10",
87-
"pytest-xdist>=3.2.1",
87+
"pytest-xdist>=3.3.1",
8888
"re-assert>=1.1",
8989
'time-machine>=2.9; implementation_name != "pypy"',
9090
"wheel>=0.40",

src/tox/session/cmd/legacy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ def legacy(state: State) -> int:
104104
if option.list_envs or option.list_envs_all:
105105
return list_env(state)
106106
if option.devenv_path:
107+
if option.env.is_default_list:
108+
option.env = CliEnv(["py"])
107109
option.devenv_path = Path(option.devenv_path)
108110
return devenv(state)
109111
if option.parallel != 0: # only 0 means sequential

tests/session/cmd/test_legacy.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,27 @@ def test_legacy_list_all(tox_project: ToxProjectCreator, mocker: MockerFixture,
7878
assert outcome.state.conf.options.show_core is False
7979

8080

81-
def test_legacy_devenv(tox_project: ToxProjectCreator, mocker: MockerFixture, tmp_path: Path) -> None:
82-
devenv = mocker.patch("tox.session.cmd.legacy.devenv")
81+
@pytest.mark.parametrize(
82+
"args",
83+
[
84+
pytest.param((), id="empty"),
85+
pytest.param(("-e", "py"), id="select"),
86+
],
87+
)
88+
def test_legacy_devenv(
89+
tox_project: ToxProjectCreator,
90+
mocker: MockerFixture,
91+
tmp_path: Path,
92+
args: tuple[str, ...],
93+
) -> None:
94+
run_sequential = mocker.patch("tox.session.cmd.devenv.run_sequential")
8395
into = tmp_path / "b"
8496

85-
outcome = tox_project({"tox.ini": ""}).run("le", "--devenv", str(into), "-e", "py")
97+
outcome = tox_project({"tox.ini": ""}).run("le", "--devenv", str(into), *args)
8698

87-
assert devenv.call_count == 1
99+
assert run_sequential.call_count == 1
88100
assert outcome.state.conf.options.devenv_path == into
101+
assert set(outcome.state.conf.options.env) == {"py"}
89102

90103

91104
def test_legacy_run_parallel(tox_project: ToxProjectCreator, mocker: MockerFixture) -> None:

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ commands =
4141
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
4242
skip_install = true
4343
deps =
44-
pre-commit>=3.2.2
44+
pre-commit>=3.3.2
4545
pass_env =
4646
{[testenv]passenv}
4747
PROGRAMDATA
@@ -52,9 +52,9 @@ commands =
5252
[testenv:type]
5353
description = run type check on code base
5454
deps =
55-
mypy==1.2
55+
mypy==1.3
5656
types-cachetools>=5.3.0.5
57-
types-chardet>=5.0.4.3
57+
types-chardet>=5.0.4.6
5858
commands =
5959
mypy src/tox
6060
mypy tests

0 commit comments

Comments
 (0)