From 4c8d22aa125e68c6f45b4f71359c1bd7942f844f Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Wed, 7 Oct 2026 17:00:15 -0400 Subject: [PATCH 1/2] py311+ Committed via https://github.com/asottile/all-repos --- .github/actions/pre-test/action.yml | 2 +- .github/workflows/languages.yaml | 4 ++-- .github/workflows/main.yml | 8 ++++---- .pre-commit-config.yaml | 4 ++-- setup.cfg | 2 +- testing/zipapp/Dockerfile | 2 +- testing/zipapp/make | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/pre-test/action.yml b/.github/actions/pre-test/action.yml index f5272c847..58a4ae67d 100644 --- a/.github/actions/pre-test/action.yml +++ b/.github/actions/pre-test/action.yml @@ -6,4 +6,4 @@ runs: using: composite steps: - uses: asottile/workflows/.github/actions/latest-git@v1.4.0 - if: inputs.env == 'py310' && runner.os == 'Linux' + if: inputs.env == 'py311' && runner.os == 'Linux' diff --git a/.github/workflows/languages.yaml b/.github/workflows/languages.yaml index e276a55b0..92e0e24fa 100644 --- a/.github/workflows/languages.yaml +++ b/.github/workflows/languages.yaml @@ -21,7 +21,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: install deps run: python -mpip install -e . -r requirements-dev.txt - name: vars @@ -39,7 +39,7 @@ jobs: - uses: asottile/workflows/.github/actions/fast-checkout@v1.8.1 - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - run: echo "$CONDA\Scripts" >> "$GITHUB_PATH" shell: bash diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02b11ae28..bf12183c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,12 +12,12 @@ concurrency: jobs: main-windows: - uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 + uses: asottile/workflows/.github/workflows/tox.yml@v1.11.1 with: - env: '["py310"]' + env: '["py311"]' os: windows-latest main-linux: - uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1 + uses: asottile/workflows/.github/workflows/tox.yml@v1.11.1 with: - env: '["py310", "py311", "py312", "py313"]' + env: '["py311", "py312", "py313", "py314"]' os: ubuntu-latest diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f72045857..bd41a449b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: hooks: - id: reorder-python-imports exclude: ^pre_commit/resources/ - args: [--py310-plus, --add-import, 'from __future__ import annotations'] + args: [--py311-plus, --add-import, 'from __future__ import annotations'] - repo: https://github.com/asottile/add-trailing-comma rev: v4.0.0 hooks: @@ -27,7 +27,7 @@ repos: rev: v3.21.2 hooks: - id: pyupgrade - args: [--py310-plus] + args: [--py311-plus] - repo: https://github.com/hhatto/autopep8 rev: v2.3.2 hooks: diff --git a/setup.cfg b/setup.cfg index 6113e6973..f735137b9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ install_requires = nodeenv>=0.11.1 pyyaml>=5.1 virtualenv>=20.10.0 -python_requires = >=3.10 +python_requires = >=3.11 [options.packages.find] exclude = diff --git a/testing/zipapp/Dockerfile b/testing/zipapp/Dockerfile index ea967e383..14b6234ec 100644 --- a/testing/zipapp/Dockerfile +++ b/testing/zipapp/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:jammy +FROM ubuntu:noble RUN : \ && apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ diff --git a/testing/zipapp/make b/testing/zipapp/make index 43bb4373f..20d6d35a8 100755 --- a/testing/zipapp/make +++ b/testing/zipapp/make @@ -44,7 +44,7 @@ def _add_shim(dest: str) -> None: with tempfile.TemporaryDirectory() as tmpdir: _exit_if_retv( 'podman', 'run', '--rm', '--volume', f'{tmpdir}:/out:rw', IMG, - 'cp', '/venv/lib/python3.10/site-packages/distlib/t32.exe', '/out', + 'cp', '/venv/lib/python3.12/site-packages/distlib/t32.exe', '/out', ) with open(os.path.join(dest, 'python.exe'), 'wb') as f: From 2be170142fb6e0f1402a8bf036b5c9f8dd27fd09 Mon Sep 17 00:00:00 2001 From: anthony sottile Date: Thu, 8 Oct 2026 14:47:21 -0400 Subject: [PATCH 2/2] remove triple-nested withs for 3.14 coverage see coveragepy/coveragepy#1987 --- tests/color_test.py | 30 ++++++++++++++++++------------ tests/commands/run_test.py | 26 +++++++++++++++----------- tests/repository_test.py | 16 +++++++++------- 3 files changed, 42 insertions(+), 30 deletions(-) diff --git a/tests/color_test.py b/tests/color_test.py index 89b4fd3eb..e8da98abc 100644 --- a/tests/color_test.py +++ b/tests/color_test.py @@ -36,24 +36,30 @@ def test_use_color_no_tty(): def test_use_color_tty_with_color_support(): - with mock.patch.object(sys.stderr, 'isatty', return_value=True): - with mock.patch('pre_commit.color.terminal_supports_color', True): - with envcontext.envcontext((('TERM', envcontext.UNSET),)): - assert use_color('auto') is True + with ( + mock.patch.object(sys.stderr, 'isatty', return_value=True), + mock.patch('pre_commit.color.terminal_supports_color', True), + envcontext.envcontext((('TERM', envcontext.UNSET),)), + ): + assert use_color('auto') is True def test_use_color_tty_without_color_support(): - with mock.patch.object(sys.stderr, 'isatty', return_value=True): - with mock.patch('pre_commit.color.terminal_supports_color', False): - with envcontext.envcontext((('TERM', envcontext.UNSET),)): - assert use_color('auto') is False + with ( + mock.patch.object(sys.stderr, 'isatty', return_value=True), + mock.patch('pre_commit.color.terminal_supports_color', False), + envcontext.envcontext((('TERM', envcontext.UNSET),)), + ): + assert use_color('auto') is False def test_use_color_dumb_term(): - with mock.patch.object(sys.stderr, 'isatty', return_value=True): - with mock.patch('pre_commit.color.terminal_supports_color', True): - with envcontext.envcontext((('TERM', 'dumb'),)): - assert use_color('auto') is False + with ( + mock.patch.object(sys.stderr, 'isatty', return_value=True), + mock.patch('pre_commit.color.terminal_supports_color', True), + envcontext.envcontext((('TERM', 'dumb'),)), + ): + assert use_color('auto') is False def test_use_color_raises_if_given_shenanigans(): diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py index e4af1e162..7a80c8e44 100644 --- a/tests/commands/run_test.py +++ b/tests/commands/run_test.py @@ -1123,20 +1123,24 @@ def test_classifier_removes_dne(): def test_classifier_normalizes_filenames_on_windows_to_forward_slashes(tmpdir): - with tmpdir.as_cwd(): - tmpdir.join('a/b/c').ensure() - with mock.patch.object(os, 'altsep', '/'): - with mock.patch.object(os, 'sep', '\\'): - classifier = Classifier.from_config((r'a\b\c',), '', '^$') - assert classifier.filenames == ['a/b/c'] + tmpdir.join('a/b/c').ensure() + with ( + tmpdir.as_cwd(), + mock.patch.object(os, 'altsep', '/'), + mock.patch.object(os, 'sep', '\\'), + ): + classifier = Classifier.from_config((r'a\b\c',), '', '^$') + assert classifier.filenames == ['a/b/c'] def test_classifier_does_not_normalize_backslashes_non_windows(tmpdir): - with mock.patch.object(os.path, 'lexists', return_value=True): - with mock.patch.object(os, 'altsep', None): - with mock.patch.object(os, 'sep', '/'): - classifier = Classifier.from_config((r'a/b\c',), '', '^$') - assert classifier.filenames == [r'a/b\c'] + with ( + mock.patch.object(os.path, 'lexists', return_value=True), + mock.patch.object(os, 'altsep', None), + mock.patch.object(os, 'sep', '/'), + ): + classifier = Classifier.from_config((r'a/b\c',), '', '^$') + assert classifier.filenames == [r'a/b\c'] def test_classifier_empty_types_or(tmpdir): diff --git a/tests/repository_test.py b/tests/repository_test.py index 5d71c3e4c..63f5d1610 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -239,14 +239,16 @@ class MyKeyboardInterrupt(KeyboardInterrupt): # To simulate a killed install, we'll make PythonEnv.run raise ^C # and then to simulate a second ^C during cleanup, we'll make shutil.rmtree # raise as well. - with pytest.raises(MyKeyboardInterrupt): - with mock.patch.object( - lang_base, 'setup_cmd', side_effect=MyKeyboardInterrupt, - ): - with mock.patch.object( + with ( + pytest.raises(MyKeyboardInterrupt), + mock.patch.object( + lang_base, 'setup_cmd', side_effect=MyKeyboardInterrupt, + ), + mock.patch.object( shutil, 'rmtree', side_effect=MyKeyboardInterrupt, - ): - install_hook_envs(hooks, store) + ), + ): + install_hook_envs(hooks, store) # Should have made an environment, however this environment is broken! hook, = hooks