Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tox-dev/tox
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.11.3
Choose a base ref
...
head repository: tox-dev/tox
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.11.4
Choose a head ref
  • 17 commits
  • 16 files changed
  • 10 contributors

Commits on Sep 11, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3124)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Sep 11, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    29e0f70 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    9429881 View commit details

Commits on Sep 18, 2023

  1. docs(config): fix default value for install_command (#3126)

    The `install_command` config is documented as having the default value:
    
      python -I -m pip install <opts> <packages>
    
    The last two arguments are not substituable and are thus passed as is
    (eg as packages to install) resulting in:
    
      py3-test: install_deps> python -I -m pip install -v '<opts>'
      '<packages>' '.[test]'
      ERROR: Invalid requirement: '<opts>'
    
    Adjust the documentation to use the replaceable variables: `{opts}` and
    `{packages}`.
    hashar authored Sep 18, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    85ce052 View commit details

Commits on Sep 27, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3128)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Sep 27, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    bcfbaed View commit details

Commits on Oct 2, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3132)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Oct 2, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    ca2570a View commit details

Commits on Oct 5, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    9ebcfef View commit details

Commits on Oct 20, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    bab2d2a View commit details
  2. [pre-commit.ci] pre-commit autoupdate (#3135)

    updates:
    - [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0)
    - [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](codespell-project/codespell@v2.2.5...v2.2.6)
    - [github.com/astral-sh/ruff-pre-commit: v0.0.291 → v0.0.292](astral-sh/ruff-pre-commit@v0.0.291...v0.0.292)
    
    Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Oct 20, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    c223cff View commit details

Commits on Oct 24, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0a2a386 View commit details

Commits on Oct 30, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3147)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Oct 30, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    065740c View commit details

Commits on Nov 6, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3149)

    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Nov 6, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    adf04c7 View commit details

Commits on Nov 14, 2023

  1. [pre-commit.ci] pre-commit autoupdate

    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.5](astral-sh/ruff-pre-commit@v0.1.4...v0.1.5)
    - [github.com/tox-dev/pyproject-fmt: 1.4.1 → 1.5.1](tox-dev/pyproject-fmt@1.4.1...1.5.1)
    - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v3.1.0](pre-commit/mirrors-prettier@v3.0.3...v3.1.0)
    - [github.com/astral-sh/ruff-pre-commit: v0.1.4 → v0.1.5](astral-sh/ruff-pre-commit@v0.1.4...v0.1.5)
    pre-commit-ci[bot] authored and jugmac00 committed Nov 14, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5c184de View commit details
  2. [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci
    pre-commit-ci[bot] authored and jugmac00 committed Nov 14, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    2e9e8b2 View commit details

Commits on Nov 27, 2023

  1. [pre-commit.ci] pre-commit autoupdate (#3161)

    updates:
    - [github.com/astral-sh/ruff-pre-commit: v0.1.5 → v0.1.6](astral-sh/ruff-pre-commit@v0.1.5...v0.1.6)
    - [github.com/astral-sh/ruff-pre-commit: v0.1.5 → v0.1.6](astral-sh/ruff-pre-commit@v0.1.5...v0.1.6)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Nov 27, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0303efd View commit details

Commits on Nov 28, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    576a820 View commit details
  2. Fixed 'AppData' not passed to env by default (#3151) (#3160)

    Co-authored-by: Decee1 <48594001+Decee1@users.noreply.github.com>
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    3 people authored Nov 28, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    leoortizz Leonardo Ortiz
    Copy the full SHA
    b84e9ae View commit details
  3. release 4.11.4

    gaborbernat committed Nov 28, 2023

    Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
    Copy the full SHA
    583ce54 View commit details
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args: ["--ignore-words-list", "crate,releas", "--skip", "*.svg"]
additional_dependencies:
- tomli
- tomli>=2.0.1
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.1
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.1.0
rev: 1.5.1
hooks:
- id: pyproject-fmt
additional_dependencies: ["tox>=4.10"]
additional_dependencies: ["tox>=4.11.3"]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v3.1.0
hooks:
- id: prettier
args: ["--print-width=120", "--prose-wrap=always"]
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.7]
additional_dependencies: [black==23.10.1]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
rev: v0.1.6
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --unsafe-fixes]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
16 changes: 15 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -4,6 +4,20 @@ Release History

.. towncrier release notes start
v4.11.4 (2023-11-27)
--------------------

Bugfixes - 4.11.4
~~~~~~~~~~~~~~~~~
- Fix terminal size of tox subcommands (fixes ipython, ipdb, prompt_toolkit, ...). (:issue:`2999`)
- Fix ``quickstart`` command from requiring ``root`` positional argument (:issue:`3084`)
- Added 'AppData' to the default passed environment variables on Windows. (:issue:`3151`)

Improved Documentation - 4.11.4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix default value for ``install_command`` - by :user:`hashar`. (:issue:`3126`)
- Fix default value for ``base_python`` - by :user:`rpatterson`. (:issue:`3156`)

v4.11.3 (2023-09-08)
--------------------

@@ -538,7 +552,7 @@ Bugfixes - 4.1.1

Improved Documentation - 4.1.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add faq entry about re-use of environments - by :user:`jugmac00`. (:issue:`2788`)
- Add faq entry about reuse of environments - by :user:`jugmac00`. (:issue:`2788`)


v4.1.0 (2022-12-29)
4 changes: 2 additions & 2 deletions docs/config.rst
Original file line number Diff line number Diff line change
@@ -530,7 +530,7 @@ Python options
~~~~~~~~~~~~~~
.. conf::
:keys: base_python, basepython
:default: {package_root}
:default: <{env_name} python factor> or <python version of tox>

Name or path to a Python interpreter which will be used for creating the virtual environment, first one found wins.
This determines in practice the Python for what we'll create a virtual isolated environment. Use this to specify the
@@ -795,7 +795,7 @@ Pip installer

.. conf::
:keys: install_command
:default: python -I -m pip install <opts> <packages>
:default: python -I -m pip install {opts} {packages}
:version_added: 1.6

Determines the command used for installing packages into the virtual environment; both the package under test and its
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ Python and OS Compatibility

tox works with the following Python interpreter implementations:

- `CPython <https://www.python.org/>`_ versions 3.7, 3.8, 3.9, 3.10, 3.11
- `CPython <https://www.python.org/>`_ versions 3.7, 3.8, 3.9, 3.10, 3.11, 3.12

This means tox works on the latest patch version of each of these minor versions. Previous patch versions are supported
on a best effort approach.
4 changes: 2 additions & 2 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
@@ -136,10 +136,10 @@ Output changes
- We now use colors for reporting, to help make the output easier to read for humans. This can be disabled via the
``TERM=dumb`` or ``NO_COLOR=1`` environment variables, or the ``--colored no`` CLI argument.

Re-use of environments
Reuse of environments
----------------------

- It is no longer possible to re-use environments. While this might have been possible with tox version 3, this
- It is no longer possible to reuse environments. While this might have been possible with tox version 3, this
behavior was never supported, and possibly caused wrong results as illustrated in the following example.

.. code-block:: ini
30 changes: 18 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -102,9 +102,6 @@ build.hooks.vcs.version-file = "src/tox/version.py"
build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
version.source = "vcs"

[tool.black]
line-length = 120

[tool.ruff]
select = ["ALL"]
line-length = 120
@@ -119,6 +116,15 @@ ignore = [
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interface
"COM812", # conflicts with formatter
"COM819", # conflicts with formatter
"E501", # conflicts with formatter
"ISC001", # conflicts with formatter
"Q000", # conflicts with formatter
"Q001", # conflicts with formatter
"Q002", # conflicts with formatter
"Q003", # conflicts with formatter
"W191", # conflicts with formatter
]
[tool.ruff.per-file-ignores]
"tests/**/*.py" = [
@@ -150,6 +156,15 @@ report.omit = ["src/tox/config/cli/for_docs.py", "tests/execute/local_subprocess
run.parallel = true
run.plugins = ["covdefaults"]

[tool.towncrier]
name = "tox"
filename = "docs/changelog.rst"
directory = "docs/changelog"
title_format = false
issue_format = ":issue:`{issue}`"
template = "docs/changelog/template.jinja2"
# possible types, all default: feature, bugfix, doc, removal, misc

[tool.mypy]
python_version = "3.11"
show_error_codes = true
@@ -167,12 +182,3 @@ overrides = [
"virtualenv.*",
], ignore_missing_imports = true },
]

[tool.towncrier]
name = "tox"
filename = "docs/changelog.rst"
directory = "docs/changelog"
title_format = false
issue_format = ":issue:`{issue}`"
template = "docs/changelog/template.jinja2"
# possible types, all default: feature, bugfix, doc, removal, misc
2 changes: 1 addition & 1 deletion src/tox/config/loader/ini/replace.py
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@


class MatchRecursionError(ValueError):
"""Could not stabalize on replacement value."""
"""Could not stabilize on replacement value."""


class MatchError(Exception):
3 changes: 1 addition & 2 deletions src/tox/config/of_type.py
Original file line number Diff line number Diff line change
@@ -116,8 +116,7 @@ def __eq__(self, o: object) -> bool:
return (
type(self) == type(o)
and super().__eq__(o)
and (self.of_type, self.default, self.post_process)
== (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
and (self.of_type, self.default, self.post_process) == (o.of_type, o.default, o.post_process) # type: ignore[attr-defined]
)


2 changes: 1 addition & 1 deletion src/tox/execute/local_sub_process/__init__.py
Original file line number Diff line number Diff line change
@@ -314,7 +314,7 @@ def _pty(key: str) -> tuple[int, int] | None:
# adjust sub-process terminal size
columns, lines = shutil.get_terminal_size(fallback=(-1, -1))
if columns != -1 and lines != -1:
size = struct.pack("HHHH", columns, lines, 0, 0)
size = struct.pack("HHHH", lines, columns, 0, 0)
fcntl.ioctl(child, termios.TIOCSWINSZ, size)

return main, child
1 change: 1 addition & 0 deletions src/tox/session/cmd/quickstart.py
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ def tox_add_option(parser: ToxParser) -> None:
"quickstart_root",
metavar="root",
default=Path().absolute(),
nargs="?",
help="folder to create the tox.ini file",
type=Path,
)
1 change: 1 addition & 0 deletions src/tox/tox_env/python/api.py
Original file line number Diff line number Diff line change
@@ -118,6 +118,7 @@ def _default_pass_env(self) -> list[str]:
if sys.platform == "win32": # pragma: win32 cover
env.extend(
[
"APPDATA", # Needed for PIP platformsdirs.windows
"PROGRAMDATA", # needed for discovering the VS compiler
"PROGRAMFILES(x86)", # needed for discovering the VS compiler
"PROGRAMFILES", # needed for discovering the VS compiler
36 changes: 36 additions & 0 deletions tests/execute/local_subprocess/test_local_subprocess.py
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

from tox.execute.api import ExecuteOptions, Outcome
from tox.execute.local_sub_process import SIG_INTERRUPT, LocalSubProcessExecuteInstance, LocalSubProcessExecutor
from tox.execute.local_sub_process.read_via_thread_unix import ReadViaThreadUnix
from tox.execute.request import ExecuteRequest, StdinSource
from tox.execute.stream import SyncWrite
from tox.report import NamedBytesIO
@@ -140,6 +141,41 @@ def test_local_execute_write_a_lot(os_env: dict[str, str]) -> None:
assert outcome.err == expected_err, expected_err[len(outcome.err) :]


@pytest.mark.skipif(sys.platform == "win32", reason="Unix terminal size test")
def test_local_execute_terminal_size(os_env: dict[str, str], monkeypatch: MonkeyPatch) -> None:
"""Regression test for #2999 - check terminal size is set correctly in tox subprocess."""
import pty

terminal_size = os.terminal_size((84, 42))
main, child = pty.openpty() # type: ignore[attr-defined, unused-ignore]
# Use ReadViaThreadUnix to help with debugging the test itself.
pipe_out = ReadViaThreadUnix(main, sys.stdout.buffer.write, name="testout", drain=True) # type: ignore[arg-type]
with pipe_out, monkeypatch.context() as monkey, open(child, "w") as stdout_mock: # noqa: PTH123
# Switch stdout with test pty
monkey.setattr(sys, "stdout", stdout_mock)
monkey.setenv("COLUMNS", "84")
monkey.setenv("LINES", "42")

executor = LocalSubProcessExecutor(colored=False)
request = ExecuteRequest(
cmd=[sys.executable, "-c", "import os; print(os.get_terminal_size())"],
cwd=Path(),
env=os_env,
stdin=StdinSource.OFF,
run_id="",
)
out_err = FakeOutErr()
with executor.call(request, show=False, out_err=out_err.out_err, env=MagicMock()) as status:
while status.exit_code is None: # pragma: no branch
status.wait()
outcome = status.outcome
assert outcome is not None
assert bool(outcome), outcome
expected_out = f"{terminal_size!r}\r\n"
assert outcome.out == expected_out, expected_out[len(outcome.out) :]
assert not outcome.err


def test_local_execute_basic_fail(capsys: CaptureFixture, caplog: LogCaptureFixture, monkeypatch: MonkeyPatch) -> None:
monkeypatch.chdir(Path(__file__).parents[3])
caplog.set_level(logging.NOTSET)
5 changes: 5 additions & 0 deletions tests/session/cmd/test_quickstart.py
Original file line number Diff line number Diff line change
@@ -53,3 +53,8 @@ def test_quickstart_refuse(tox_project: ToxProjectCreator) -> None:
def test_quickstart_help(tox_project: ToxProjectCreator) -> None:
outcome = tox_project({"tox.ini": ""}).run("q", "-h")
outcome.assert_success()


def test_quickstart_no_args(tox_project: ToxProjectCreator) -> None:
outcome = tox_project({}).run("q")
outcome.assert_success()
8 changes: 5 additions & 3 deletions tests/session/cmd/test_show_config.py
Original file line number Diff line number Diff line change
@@ -119,7 +119,9 @@ def test_pass_env_config_default(tox_project: ToxProjectCreator, stdout_is_atty:
pass_env = outcome.env_conf("py")["pass_env"]
is_win = sys.platform == "win32"
expected = (
["CC", "CCSHARED", "CFLAGS"]
[]
+ (["APPDATA"] if is_win else [])
+ ["CC", "CCSHARED", "CFLAGS"]
+ (["COMSPEC"] if is_win else [])
+ ["CPPFLAGS", "CURL_CA_BUNDLE", "CXX", "HOME", "LANG", "LANGUAGE", "LDFLAGS", "LD_LIBRARY_PATH"]
+ (["MSYSTEM", "NUMBER_OF_PROCESSORS", "PATHEXT"] if is_win else [])
@@ -262,7 +264,7 @@ def test_show_config_matching_env_section(tox_project: ToxProjectCreator) -> Non


def test_package_env_inherits_from_pkgenv(tox_project: ToxProjectCreator, demo_pkg_inline: Path) -> None:
project = tox_project({"tox.ini": "[pkgenv]\npass_env = A, B\ndeps=C\n D"})
project = tox_project({"tox.ini": "[pkgenv]\npass_env = A, AA\ndeps=C\n D"})
outcome = project.run("c", "--root", str(demo_pkg_inline), "-k", "deps", "pass_env", "-e", "py,.pkg")
outcome.assert_success()
exp = """
@@ -272,7 +274,7 @@ def test_package_env_inherits_from_pkgenv(tox_project: ToxProjectCreator, demo_p
D
pass_env =
A
B
AA
"""
exp = dedent(exp)
assert exp in outcome.out
2 changes: 1 addition & 1 deletion tests/test_provision.py
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ def _make_tox_wheel(
into = tmp_path_factory.mktemp("dist") # pragma: no cover
from tox.version import version_tuple

version = f"{version_tuple[0]}.{version_tuple[1]}.{version_tuple[2] +1}"
version = f"{version_tuple[0]}.{version_tuple[1]}.{int(version_tuple[2]) +1}"
with mock.patch.dict(os.environ, {"SETUPTOOLS_SCM_PRETEND_VERSION": version}):
return pkg_builder(into, Path(__file__).parents[1], ["wheel"], False) # pragma: no cover

14 changes: 7 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -41,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.3.3
pre-commit>=3.5
pass_env =
{[testenv]passenv}
PROGRAMDATA
@@ -52,7 +52,7 @@ commands =
[testenv:type]
description = run type check on code base
deps =
mypy==1.5.1
mypy==1.6.1
types-cachetools>=5.3.0.6
types-chardet>=5.0.4.6
commands =
@@ -73,8 +73,8 @@ commands =
description = check that the long description is valid
skip_install = true
deps =
build[virtualenv]>=0.10
check-wheel-contents>=0.4
build[virtualenv]>=1.0.3
check-wheel-contents>=0.5
twine>=4.0.2
commands =
python -m build -o {envtmpdir} -s -w .
@@ -85,9 +85,9 @@ commands =
description = do a release, required posarg of the version number
skip_install = true
deps =
gitpython>=3.1.32
packaging>=23.1
towncrier>=23.6
gitpython>=3.1.40
packaging>=23.2
towncrier>=23.10
commands =
python {toxinidir}/tasks/release.py --version {posargs}