From 6fc2b2ccd640c1981f84c99a4bc2870a40350d14 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:20:00 +0000 Subject: [PATCH 1/5] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0) - [github.com/asottile/reorder-python-imports: v3.14.0 → v3.19.0](https://github.com/asottile/reorder-python-imports/compare/v3.14.0...v3.19.0) - https://github.com/psf/black → https://github.com/psf/black-pre-commit-mirror - [github.com/psf/black-pre-commit-mirror: 24.10.0 → 26.10.1](https://github.com/psf/black-pre-commit-mirror/compare/24.10.0...26.10.1) - [github.com/PyCQA/flake8: 7.1.1 → 7.4.1](https://github.com/PyCQA/flake8/compare/7.1.1...7.4.1) - [github.com/PyCQA/autoflake: v2.3.1 → v2.4.0](https://github.com/PyCQA/autoflake/compare/v2.3.1...v2.4.0) - [github.com/pre-commit/mirrors-mypy: v1.14.1 → v2.4.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.1...v2.4.0) --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f832bdf..73d1c73 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-byte-order-marker - id: trailing-whitespace @@ -9,16 +9,16 @@ repos: args: [--remove] - id: check-yaml - repo: https://github.com/asottile/reorder-python-imports - rev: v3.14.0 + rev: v3.19.0 hooks: - id: reorder-python-imports args: ['--application-directories=.:src', --py3-plus] -- repo: https://github.com/psf/black - rev: 24.10.0 +- repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.10.1 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 7.1.1 + rev: 7.4.1 hooks: - id: flake8 additional_dependencies: [flake8-bugbear] @@ -31,11 +31,11 @@ repos: language: python additional_dependencies: [pygments, restructuredtext_lint] - repo: https://github.com/PyCQA/autoflake - rev: v2.3.1 + rev: v2.4.0 hooks: - id: autoflake - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v2.4.0 hooks: - id: mypy files: ^(src/|tests/) From a95f29df647e4c5bf3a4327ef52a01216f6bf8b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 19 Oct 2026 22:21:38 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytest_flask/_internal.py | 1 - src/pytest_flask/plugin.py | 8 ++--- tests/test_live_server.py | 57 +++++++++++------------------------ 3 files changed, 22 insertions(+), 44 deletions(-) diff --git a/src/pytest_flask/_internal.py b/src/pytest_flask/_internal.py index df52314..ec5c9d4 100644 --- a/src/pytest_flask/_internal.py +++ b/src/pytest_flask/_internal.py @@ -5,7 +5,6 @@ from pytest import Config as _PytestConfig - _PytestScopeName = Literal["session", "package", "module", "class", "function"] diff --git a/src/pytest_flask/plugin.py b/src/pytest_flask/plugin.py index 6bb78d5..cf4641e 100644 --- a/src/pytest_flask/plugin.py +++ b/src/pytest_flask/plugin.py @@ -1,10 +1,11 @@ #!/usr/bin/env python """ - A py.test plugin which helps testing Flask applications. +A py.test plugin which helps testing Flask applications. - :copyright: (c) by Vital Kudzelka - :license: MIT +:copyright: (c) by Vital Kudzelka +:license: MIT """ + from typing import Any from typing import List from typing import Protocol @@ -25,7 +26,6 @@ from .fixtures import live_server from .pytest_compat import getfixturevalue - _Response = TypeVar("_Response") diff --git a/tests/test_live_server.py b/tests/test_live_server.py index 3f365aa..3cedd0b 100755 --- a/tests/test_live_server.py +++ b/tests/test_live_server.py @@ -3,7 +3,6 @@ import pytest from flask import url_for - pytestmark = pytest.mark.skipif(not hasattr(os, "fork"), reason="needs fork") @@ -35,44 +34,38 @@ def test_set_application_server_name(self, live_server): ) def test_rewrite_application_server_name(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest @pytest.mark.options(server_name='example.com:5000') def test_a(live_server): assert live_server.app.config['SERVER_NAME'] == \\ 'example.com:%d' % live_server.port - """ - ) + """) result = appdir.runpytest("-v", "-o", "live_server_scope=function") result.stdout.fnmatch_lines(["*PASSED*"]) assert result.ret == 0 def test_prevent_starting_live_server(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest def test_a(live_server): assert live_server._process is None - """ - ) + """) result = appdir.runpytest("-v", "--no-start-live-server") result.stdout.fnmatch_lines(["*passed*"]) assert result.ret == 0 def test_start_live_server(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest def test_a(live_server): assert live_server._process assert live_server._process.is_alive() - """ - ) + """) result = appdir.runpytest("-v", "--start-live-server") result.stdout.fnmatch_lines(["*passed*"]) assert result.ret == 0 @@ -103,8 +96,7 @@ def mocked_stop_cleanly(*args, **kwargs): monkeypatch.setattr(LiveServer, "_stop_cleanly", mocked_stop_cleanly) - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest from flask import url_for @@ -119,8 +111,7 @@ def index(): res = client.get(url_for('index', _external=True)) assert res.status_code == 200 assert b'got it' in res.data - """ - ) + """) args = [] if clean_stop else ["--no-live-server-clean-stop"] result = appdir.runpytest_inprocess("-v", "--no-start-live-server", *args) result.stdout.fnmatch_lines("*1 passed*") @@ -130,8 +121,7 @@ def index(): assert stop_cleanly_result == [] def test_add_endpoint_to_live_server(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest from flask import url_for @@ -146,16 +136,14 @@ def new_endpoint(): res = client.get(url_for('new_endpoint', _external=True)) assert res.status_code == 200 assert b'got it' in res.data - """ - ) + """) result = appdir.runpytest("-v", "--no-start-live-server") result.stdout.fnmatch_lines(["*passed*"]) assert result.ret == 0 @pytest.mark.skip("this test hangs in the original code") def test_concurrent_requests_to_live_server(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest from flask import url_for @@ -175,51 +163,42 @@ def two(): res = client.get(url_for('one', _external=True)) assert res.status_code == 200 assert b'42' in res.data - """ - ) + """) result = appdir.runpytest("-v", "--no-start-live-server") result.stdout.fnmatch_lines(["*passed*"]) assert result.ret == 0 @pytest.mark.parametrize("port", [5000, 5001]) def test_live_server_fixed_port(self, port, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest def test_port(live_server): assert live_server.port == %d - """ - % port - ) + """ % port) result = appdir.runpytest("-v", "--live-server-port", str(port)) result.stdout.fnmatch_lines(["*PASSED*"]) assert result.ret == 0 @pytest.mark.parametrize("host", ["127.0.0.1", "0.0.0.0"]) def test_live_server_fixed_host(self, host, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest def test_port(live_server): assert live_server.host == '%s' - """ - % host - ) + """ % host) result = appdir.runpytest("-v", "--live-server-host", str(host)) result.stdout.fnmatch_lines(["*PASSED*"]) assert result.ret == 0 def test_respect_wait_timeout(self, appdir): - appdir.create_test_module( - """ + appdir.create_test_module(""" import pytest def test_should_fail(live_server): assert live_server._process.is_alive() - """ - ) + """) result = appdir.runpytest("-v", "--live-server-wait=0.00000001") result.stdout.fnmatch_lines(["**ERROR**"]) assert result.ret == 1 From f6ff31ff5d079e1c5d8a78891079526ac59ab320 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 22 Oct 2026 15:34:53 +0200 Subject: [PATCH 3/5] Fix CI after pre-commit autoupdate - Drop removed fix-encoding-pragma hook, rename check-byte-order-marker to fix-byte-order-marker (removed in pre-commit-hooks v6). - Replace reorder-python-imports with isort: it now strips the blank line after the module docstring that black 24+ adds, so the two hooks loop forever. - Drop --encoding from rst-lint, no longer supported. - Bump GitHub Actions: build-and-inspect-python-package v1.5 relied on the deprecated upload-artifact v3 that GitHub now rejects. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/deploy.yml | 12 ++++++------ .github/workflows/test.yml | 10 +++++----- .pre-commit-config.yaml | 14 ++++++-------- src/pytest_flask/fixtures.py | 2 +- src/pytest_flask/live_server.py | 2 +- 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bc1ae15..7022e95 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,10 +16,10 @@ jobs: SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v1.5 + uses: hynek/build-and-inspect-python-package@v3.0.2 deploy: needs: package @@ -30,16 +30,16 @@ jobs: contents: write # For tag and release notes. steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download Package - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v8 with: name: Packages path: dist - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@v1.8.5 + uses: pypa/gh-action-pypi-publish@v1.14.3 - name: Push tag run: | @@ -49,7 +49,7 @@ jobs: git push origin ${{ github.event.inputs.version }} - name: GitHub Release - uses: softprops/action-gh-release@v1 + uses: softprops/action-gh-release@v3 with: files: dist/* tag_name: ${{ github.event.inputs.version }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b872be2..ae14f56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,9 @@ jobs: package: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Build and Check Package - uses: hynek/build-and-inspect-python-package@v1.5 + uses: hynek/build-and-inspect-python-package@v3.0.2 test: @@ -35,16 +35,16 @@ jobs: os: [ubuntu-latest, windows-latest] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Download Package - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v8 with: name: Packages path: dist - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73d1c73..ecb1355 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,17 +2,15 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - - id: check-byte-order-marker + - id: fix-byte-order-marker - id: trailing-whitespace - id: end-of-file-fixer - - id: fix-encoding-pragma - args: [--remove] - id: check-yaml -- repo: https://github.com/asottile/reorder-python-imports - rev: v3.19.0 +- repo: https://github.com/PyCQA/isort + rev: 9.0.2 hooks: - - id: reorder-python-imports - args: ['--application-directories=.:src', --py3-plus] + - id: isort + args: [--profile=black, --force-single-line-imports, --src=src] - repo: https://github.com/psf/black-pre-commit-mirror rev: 26.10.1 hooks: @@ -26,7 +24,7 @@ repos: hooks: - id: rst name: rst - entry: rst-lint --encoding utf-8 + entry: rst-lint files: ^(RELEASING.rst|README.rst)$ language: python additional_dependencies: [pygments, restructuredtext_lint] diff --git a/src/pytest_flask/fixtures.py b/src/pytest_flask/fixtures.py index f868368..1fcb097 100644 --- a/src/pytest_flask/fixtures.py +++ b/src/pytest_flask/fixtures.py @@ -1,8 +1,8 @@ #!/usr/bin/env python import socket from typing import Any -from typing import cast from typing import Generator +from typing import cast import pytest from flask import Flask as _FlaskApp diff --git a/src/pytest_flask/live_server.py b/src/pytest_flask/live_server.py index 5f2150e..bc53651 100644 --- a/src/pytest_flask/live_server.py +++ b/src/pytest_flask/live_server.py @@ -7,9 +7,9 @@ import time from multiprocessing import Process from typing import Any -from typing import cast from typing import Protocol from typing import Union +from typing import cast import pytest From c248abcd6d2ed78b0477e15b757a5f92627db57b Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 22 Oct 2026 15:39:46 +0200 Subject: [PATCH 4/5] Remove unmaintained pytest-pep8 pytest-pep8 declares a pytest_collect_file hook with the 'path' argument, which pytest 9 removed, so pytest refuses to start. It was never enabled (no --pep8 flag) and flake8 in pre-commit already covers style checks. Co-Authored-By: Claude Opus 5.5 --- requirements/test.txt | 1 - tox.ini | 3 --- 2 files changed, 4 deletions(-) diff --git a/requirements/test.txt b/requirements/test.txt index efe407d..a0cf458 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,5 +1,4 @@ mock pylint coverage -pytest-pep8 mypy diff --git a/tox.ini b/tox.ini index d2957e4..3ffef31 100644 --- a/tox.ini +++ b/tox.ini @@ -4,9 +4,6 @@ envlist = [pytest] norecursedirs = .git .tox env coverage docs -pep8ignore = - docs/conf.py ALL -pep8maxlinelength = 79 [testenv:dev] commands = From 1474bcfaf9c17adc06b2295ab00333f13e9644c9 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Thu, 22 Oct 2026 15:41:49 +0200 Subject: [PATCH 5/5] Pin test runner to ubuntu-24.04 ubuntu-latest now resolves to Ubuntu 26.04, for which setup-python ships no Python 3.8 or 3.9 builds. Ubuntu 24.04 still has both. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ae14f56..5f83b4c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: fail-fast: false matrix: python: ["3.8", "3.9", "3.10", "3.11", "3.12"] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-24.04, windows-latest] steps: - uses: actions/checkout@v7