diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 787b01a62..a4cf17065 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,6 +18,7 @@ jobs: fail-fast: false matrix: py: + - "3.12.0-alpha.7" - "3.11" - "3.10" - "3.9" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dea5d358f..e32a4b2ab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,4 +24,4 @@ jobs: - name: Build package run: pyproject-build -s -w . -o dist - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.5 + uses: pypa/gh-action-pypi-publish@v1.8.6 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 43128a4ab..dac77aba5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: add-trailing-comma args: [--py36-plus] - repo: https://github.com/asottile/pyupgrade - rev: v3.3.1 + rev: v3.4.0 hooks: - id: pyupgrade args: ["--py37-plus"] @@ -52,7 +52,7 @@ repos: hooks: - id: flake8 additional_dependencies: - - flake8-bugbear==23.3.23 + - flake8-bugbear==23.5.9 - flake8-comprehensions==3.12 - flake8-pytest-style==1.7.2 - flake8-spellcheck==0.28 @@ -69,7 +69,7 @@ repos: - "@prettier/plugin-xml@2.2" args: ["--print-width=120", "--prose-wrap=always"] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.34.0 hooks: - id: markdownlint - repo: local diff --git a/docs/changelog.rst b/docs/changelog.rst index 48d3a7f3b..9512ddde2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,14 @@ Release History .. towncrier release notes start +v4.5.1 (2023-05-25) +------------------- + +Bugfixes - 4.5.1 +~~~~~~~~~~~~~~~~ +- Fix ``tox --devenv venv`` invocation without ``-e`` - by :user:`asottile`. (:issue:`2925`) + + v4.5.0 (2023-04-24) ------------------- diff --git a/docs/development.rst b/docs/development.rst index 2010f37ef..d060a2f09 100644 --- a/docs/development.rst +++ b/docs/development.rst @@ -226,5 +226,5 @@ Current maintainers - :user:`Anthony Sottile ` - :user:`Bernát Gábor ` - :user:`Jürgen Gmach ` -- :user:`Miroslav Šedivý ` +- :user:`Masen Furer ` - :user:`Oliver Bestwalter ` diff --git a/pyproject.toml b/pyproject.toml index 87c2ce551..828108645 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ build-backend = "hatchling.build" requires = [ "hatch-vcs>=0.3", - "hatchling>=1.14", + "hatchling>=1.17", ] [project] @@ -51,23 +51,23 @@ dependencies = [ "cachetools>=5.3", "chardet>=5.1", "colorama>=0.4.6", - "filelock>=3.11", - 'importlib-metadata>=6.4.1; python_version < "3.8"', + "filelock>=3.12", + 'importlib-metadata>=6.6; python_version < "3.8"', "packaging>=23.1", - "platformdirs>=3.2", + "platformdirs>=3.5.1", "pluggy>=1", "pyproject-api>=1.5.1", 'tomli>=2.0.1; python_version < "3.11"', - 'typing-extensions>=4.5; python_version < "3.8"', - "virtualenv>=20.21", + 'typing-extensions>=4.6.2; python_version < "3.8"', + "virtualenv>=20.23", ] optional-dependencies.docs = [ - "furo>=2023.3.27", - "sphinx>=6.1.3", + "furo>=2023.5.20", + "sphinx>=7.0.1", "sphinx-argparse-cli>=1.11", "sphinx-autodoc-typehints!=1.23.4,>=1.23", "sphinx-copybutton>=0.5.2", - "sphinx-inline-tabs>=2022.1.2b11", + "sphinx-inline-tabs>=2023.4.21", "sphinxcontrib-towncrier>=0.2.1a0", "towncrier>=22.12", ] @@ -79,12 +79,12 @@ optional-dependencies.testing = [ "distlib>=0.3.6", "flaky>=3.7", "hatch-vcs>=0.3", - "hatchling>=1.14", - "psutil>=5.9.4", + "hatchling>=1.17", + "psutil>=5.9.5", "pytest>=7.3.1", - "pytest-cov>=4", + "pytest-cov>=4.1", "pytest-mock>=3.10", - "pytest-xdist>=3.2.1", + "pytest-xdist>=3.3.1", "re-assert>=1.1", 'time-machine>=2.9; implementation_name != "pypy"', "wheel>=0.40", diff --git a/src/tox/session/cmd/legacy.py b/src/tox/session/cmd/legacy.py index e92c3d27b..82938d134 100644 --- a/src/tox/session/cmd/legacy.py +++ b/src/tox/session/cmd/legacy.py @@ -104,6 +104,8 @@ def legacy(state: State) -> int: if option.list_envs or option.list_envs_all: return list_env(state) if option.devenv_path: + if option.env.is_default_list: + option.env = CliEnv(["py"]) option.devenv_path = Path(option.devenv_path) return devenv(state) if option.parallel != 0: # only 0 means sequential diff --git a/src/tox/session/env_select.py b/src/tox/session/env_select.py index f091474d4..5bb283b3c 100644 --- a/src/tox/session/env_select.py +++ b/src/tox/session/env_select.py @@ -125,7 +125,6 @@ def __init__(self, state: State) -> None: self.on_empty_fallback_py = True self._warned_about: set[str] = set() #: shared set of skipped environments that were already warned about self._state = state - self._cli_envs: CliEnv | None = getattr(self._state.conf.options, "env", None) self._defined_envs_: None | dict[str, _ToxEnvInfo] = None self._pkg_env_counter: Counter[str] = Counter() from tox.plugin.manager import MANAGER @@ -139,6 +138,10 @@ def __init__(self, state: State) -> None: tox_env_filter_regex = getattr(state.conf.options, "skip_env", "").strip() self._filter_re = re.compile(tox_env_filter_regex) if tox_env_filter_regex else None + @property + def _cli_envs(self) -> CliEnv | None: + return getattr(self._state.conf.options, "env", None) + def _collect_names(self) -> Iterator[tuple[Iterable[str], bool]]: """:return: sources of tox environments defined with name and if is marked as target to run""" if self._provision is not None: # pragma: no branch diff --git a/tests/session/cmd/test_legacy.py b/tests/session/cmd/test_legacy.py index 957149b6f..73cc397a5 100644 --- a/tests/session/cmd/test_legacy.py +++ b/tests/session/cmd/test_legacy.py @@ -78,14 +78,27 @@ def test_legacy_list_all(tox_project: ToxProjectCreator, mocker: MockerFixture, assert outcome.state.conf.options.show_core is False -def test_legacy_devenv(tox_project: ToxProjectCreator, mocker: MockerFixture, tmp_path: Path) -> None: - devenv = mocker.patch("tox.session.cmd.legacy.devenv") +@pytest.mark.parametrize( + "args", + [ + pytest.param((), id="empty"), + pytest.param(("-e", "py"), id="select"), + ], +) +def test_legacy_devenv( + tox_project: ToxProjectCreator, + mocker: MockerFixture, + tmp_path: Path, + args: tuple[str, ...], +) -> None: + run_sequential = mocker.patch("tox.session.cmd.devenv.run_sequential") into = tmp_path / "b" - outcome = tox_project({"tox.ini": ""}).run("le", "--devenv", str(into), "-e", "py") + outcome = tox_project({"tox.ini": ""}).run("le", "--devenv", str(into), *args) - assert devenv.call_count == 1 + assert run_sequential.call_count == 1 assert outcome.state.conf.options.devenv_path == into + assert set(outcome.state.conf.options.env) == {"py"} def test_legacy_run_parallel(tox_project: ToxProjectCreator, mocker: MockerFixture) -> None: diff --git a/tests/session/test_env_select.py b/tests/session/test_env_select.py index 496107a37..e8378fc7e 100644 --- a/tests/session/test_env_select.py +++ b/tests/session/test_env_select.py @@ -2,7 +2,10 @@ import pytest +from tox.config.cli.parse import get_options from tox.pytest import MonkeyPatch, ToxProjectCreator +from tox.session.env_select import CliEnv, EnvSelector +from tox.session.state import State def test_label_core_can_define(tox_project: ToxProjectCreator) -> None: @@ -117,3 +120,11 @@ def test_tox_skip_env_logs(tox_project: ToxProjectCreator, monkeypatch: MonkeyPa outcome = project.run("l", "--no-desc") outcome.assert_success() outcome.assert_out_err("ROOT: skip environment mypy, matches filter 'm[y]py'\npy310\npy39\n", "") + + +def test_env_select_lazily_looks_at_envs() -> None: + state = State(get_options(), []) + env_selector = EnvSelector(state) + # late-assigning env should be reflected in env_selector + state.conf.options.env = CliEnv("py") + assert set(env_selector.iter()) == {"py"} diff --git a/tox.ini b/tox.ini index f546a5da2..cf0a2b921 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ requires = tox>=4.2 env_list = fix + py312 py311 py310 py39 @@ -40,7 +41,7 @@ commands = description = format the code base to adhere to our styles, and complain about what we cannot do automatically skip_install = true deps = - pre-commit>=3.2.2 + pre-commit>=3.3.2 pass_env = {[testenv]passenv} PROGRAMDATA @@ -51,9 +52,9 @@ commands = [testenv:type] description = run type check on code base deps = - mypy==1.2 + mypy==1.3 types-cachetools>=5.3.0.5 - types-chardet>=5.0.4.3 + types-chardet>=5.0.4.6 commands = mypy src/tox mypy tests