From 24bb9a9f5c1c8c8b9ab4ef6cffd35ce78c3c4a0c Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 18:22:00 +0200 Subject: [PATCH 01/12] =?UTF-8?q?=F0=9F=A7=AA=20Sync=20coveragepy=20setup?= =?UTF-8?q?=20w/=20other=20projects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifically, configure the top-level project dir as the global source, put the Python package into `source_pkgs` by name, and set up the path mapping across the Git checkout and installed site-packages location. --- .coveragerc-cython.toml | 71 +++++++++++++++++++++++++++++++------ .coveragerc.toml | 77 ++++++++++++++++++++++++++++++++--------- 2 files changed, 120 insertions(+), 28 deletions(-) diff --git a/.coveragerc-cython.toml b/.coveragerc-cython.toml index 91336d47dd9..3204ab58760 100644 --- a/.coveragerc-cython.toml +++ b/.coveragerc-cython.toml @@ -1,20 +1,69 @@ -[run] -branch = true -plugins = [ - 'Cython.Coverage', -] -omit = [ - 'site-packages', +[html] +show_contexts = true +skip_covered = false + +[paths] +_site-packages-to-src-mapping = [ + '.', + '*/lib/pypy*/site-packages', + '*/lib/python*/site-packages', + '*\Lib\site-packages', ] [report] -partial_also = [ - 'if not TYPE_CHECKING', -] exclude_also = [ 'if TYPE_CHECKING', 'assert False', ': \.\.\.(\s*#.*)?$', '^ +\.\.\.$', - 'pytest.fail\(' + 'pytest.fail\(', + '^\s*@pytest\.mark\.xfail', +] +# fail_under = 100 +partial_also = [ + 'if not TYPE_CHECKING', +] +show_missing = true +skip_covered = true +skip_empty = true + +[run] +branch = true +# NOTE: `ctrace` tracing method is needed because the `sysmon` tracer +# NOTE: which is default on Python 3.14, causes unprecedented slow-down +# NOTE: of the test runs. Also, Cython the `Cython.Coverage` plugin does +# NOTE: not support `sysmon`. +# Ref: https://github.com/coveragepy/coveragepy/issues/2099 +core = 'ctrace' +cover_pylib = false +# NOTE: `disable_warnings` is needed when `pytest-cov` runs in tandem +# NOTE: with `pytest-xdist`. These warnings are false negative in this +# NOTE: context. +# +# NOTE: It's `coveragepy` that emits the warnings and previously they +# NOTE: wouldn't get on the radar of `pytest`'s `filterwarnings` +# NOTE: mechanism. This changed, however, with `pytest >= 8.4`. And +# NOTE: since we set `filterwarnings = error`, those warnings are being +# NOTE: raised as exceptions, cascading into `pytest`'s internals and +# NOTE: causing tracebacks and crashes of the test sessions. +# +# Ref: +# * https://github.com/pytest-dev/pytest-cov/issues/693 +# * https://github.com/pytest-dev/pytest-cov/pull/695 +# * https://github.com/pytest-dev/pytest-cov/pull/696 +disable_warnings = [ + 'module-not-measured', +] +# https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts +# dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here +parallel = true +plugins = [ + 'Cython.Coverage', +] +relative_files = true +source = [ + '.', +] +source_pkgs = [ + 'aiohttp', ] diff --git a/.coveragerc.toml b/.coveragerc.toml index 409061e3514..ab1ad9025da 100644 --- a/.coveragerc.toml +++ b/.coveragerc.toml @@ -1,26 +1,69 @@ -[run] -branch = true -# NOTE: `ctrace` tracing method is needed because the `sysmon` tracer -# NOTE: which is default on Python 3.14, causes unprecedented slow-down -# NOTE: of the test runs. -# Ref: https://github.com/coveragepy/coveragepy/issues/2099 -core = 'ctrace' -source = [ - 'aiohttp', - 'tests', -] -omit = [ - 'site-packages', +[html] +show_contexts = true +skip_covered = false + +[paths] +_site-packages-to-src-mapping = [ + '.', + '*/lib/pypy*/site-packages', + '*/lib/python*/site-packages', + '*\Lib\site-packages', ] [report] -partial_also = [ - 'if not TYPE_CHECKING', -] exclude_also = [ 'if TYPE_CHECKING', 'assert False', ': \.\.\.(\s*#.*)?$', '^ +\.\.\.$', - 'pytest.fail\(' + 'pytest.fail\(', + '^\s*@pytest\.mark\.xfail', +] +# fail_under = 100 +partial_also = [ + 'if not TYPE_CHECKING', +] +show_missing = true +skip_covered = true +skip_empty = true + +[run] +branch = true +# NOTE: `ctrace` tracing method is needed because the `sysmon` tracer +# NOTE: which is default on Python 3.14, causes unprecedented slow-down +# NOTE: of the test runs. Also, Cython the `Cython.Coverage` plugin does +# NOTE: not support `sysmon`. +# Ref: https://github.com/coveragepy/coveragepy/issues/2099 +core = 'ctrace' +cover_pylib = false +# NOTE: `disable_warnings` is needed when `pytest-cov` runs in tandem +# NOTE: with `pytest-xdist`. These warnings are false negative in this +# NOTE: context. +# +# NOTE: It's `coveragepy` that emits the warnings and previously they +# NOTE: wouldn't get on the radar of `pytest`'s `filterwarnings` +# NOTE: mechanism. This changed, however, with `pytest >= 8.4`. And +# NOTE: since we set `filterwarnings = error`, those warnings are being +# NOTE: raised as exceptions, cascading into `pytest`'s internals and +# NOTE: causing tracebacks and crashes of the test sessions. +# +# Ref: +# * https://github.com/pytest-dev/pytest-cov/issues/693 +# * https://github.com/pytest-dev/pytest-cov/pull/695 +# * https://github.com/pytest-dev/pytest-cov/pull/696 +disable_warnings = [ + 'module-not-measured', +] +# https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts +# dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here +parallel = true +# plugins = [ +# 'covdefaults', +# ] +relative_files = true +source = [ + '.', +] +source_pkgs = [ + 'aiohttp', ] From ba61b72fca09fe142711195a6fc6ef7846bc3ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=87=BA=F0=9F=87=A6=20Sviatoslav=20Sydorenko=20=28?= =?UTF-8?q?=D0=A1=D0=B2=D1=8F=D1=82=D0=BE=D1=81=D0=BB=D0=B0=D0=B2=20=D0=A1?= =?UTF-8?q?=D0=B8=D0=B4=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE=29?= Date: Fri, 14 Aug 2026 21:49:37 +0200 Subject: [PATCH 02/12] Unset the parallel mode in coveragepy config It's impossible to override it from the `coverage run` CLI invocation in autobahn tests: https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 --- .coveragerc-cython.toml | 7 ++++++- .coveragerc.toml | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.coveragerc-cython.toml b/.coveragerc-cython.toml index 3204ab58760..59dd52a1ac4 100644 --- a/.coveragerc-cython.toml +++ b/.coveragerc-cython.toml @@ -56,7 +56,12 @@ disable_warnings = [ ] # https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts # dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here -parallel = true +# NOTE: tests/autobahn/test_autobahn.py::test_{client,server} +# NOTE: pass `-a|--append` to `coverage run` wich conflicts +# NOTE: with `-p|--parallel-mode`. We cannot override it on +# NOTE: the CLI level, which is why it's unset here. +# Ref: https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 +# parallel = true plugins = [ 'Cython.Coverage', ] diff --git a/.coveragerc.toml b/.coveragerc.toml index ab1ad9025da..e15dc30c035 100644 --- a/.coveragerc.toml +++ b/.coveragerc.toml @@ -56,7 +56,12 @@ disable_warnings = [ ] # https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts # dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here -parallel = true +# NOTE: tests/autobahn/test_autobahn.py::test_{client,server} +# NOTE: pass `-a|--append` to `coverage run` wich conflicts +# NOTE: with `-p|--parallel-mode`. We cannot override it on +# NOTE: the CLI level, which is why it's unset here. +# Ref: https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 +# parallel = true # plugins = [ # 'covdefaults', # ] From 257aebb9cee8266b5f813a98b4145a750b042df1 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:06:59 +0200 Subject: [PATCH 03/12] =?UTF-8?q?=F0=9F=A7=AA=20Drop=20redundant=20pytest-?= =?UTF-8?q?cov=20CLI=20source=20args?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 6b7ec04f321..62d99c90910 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -317,7 +317,7 @@ jobs: AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }} PIP_USER: 1 run: >- - pytest --junitxml=junit.xml --numprocesses=auto --cov=aiohttp/ --cov=tests/ -m 'not dev_mode and not autobahn' + pytest --junitxml=junit.xml --numprocesses=auto --cov -m 'not dev_mode and not autobahn' shell: bash - name: Re-run the failing tests with maximum verbosity if: failure() @@ -333,7 +333,7 @@ jobs: AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }} PIP_USER: 1 PYTHONDEVMODE: 1 - run: pytest -m dev_mode --cov=aiohttp/ --cov=tests/ --cov-append + run: pytest -m dev_mode --cov --cov-append shell: bash - name: Turn coverage into xml env: @@ -474,7 +474,7 @@ jobs: PIP_USER: 1 run: >- PATH="${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}" - pytest --junitxml=junit.xml --cov=aiohttp/ --cov=tests/ --timeout=0 -m autobahn + pytest --junitxml=junit.xml --cov --timeout=0 -m autobahn shell: bash - name: Turn coverage into xml env: @@ -596,7 +596,7 @@ jobs: PIP_USER: 1 run: >- pytest tests/test_client_functional.py tests/test_http_parser.py tests/test_http_writer.py tests/test_web_functional.py tests/test_web_response.py tests/test_websocket_parser.py - --cov-config=.coveragerc-cython.toml --cov=aiohttp/ --cov=tests/ --numprocesses=auto + --cov-config=.coveragerc-cython.toml --cov --numprocesses=auto -m 'not dev_mode and not autobahn' shell: bash - name: Turn coverage into xml From e71dbf033dc276ca3b1cc47f58b95c7bacc1cf9b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:35:54 +0200 Subject: [PATCH 04/12] =?UTF-8?q?=F0=9F=A7=AA=20Unspecialize=20`coverage.x?= =?UTF-8?q?ml`=20name=20in=20cython=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 62d99c90910..0bde6f298eb 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -601,11 +601,11 @@ jobs: shell: bash - name: Turn coverage into xml run: | - python -m coverage xml -o cython-coverage.xml --rcfile=.coveragerc-cython.toml + python -m coverage xml --rcfile=.coveragerc-cython.toml - name: Upload coverage uses: codecov/codecov-action@v7 with: - files: ./cython-coverage.xml + files: ./coverage.xml disable_search: true flags: cython-coverage token: ${{ secrets.CODECOV_TOKEN }} From 4d8a7edb8d29162db72c1e6f8e5b9f29430a15b0 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:40:08 +0200 Subject: [PATCH 05/12] =?UTF-8?q?=F0=9F=A7=AA=20Make=20`coverage.xml`=20vi?= =?UTF-8?q?a=20`pytest-cov`=20directly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-cd.yml | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 0bde6f298eb..e6ef440879f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -333,14 +333,8 @@ jobs: AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }} PIP_USER: 1 PYTHONDEVMODE: 1 - run: pytest -m dev_mode --cov --cov-append + run: pytest -m dev_mode --cov --cov-append --cov-report=xml shell: bash - - name: Turn coverage into xml - env: - COLOR: 'yes' - PIP_USER: 1 - run: | - python -m coverage xml - name: Upload coverage uses: codecov/codecov-action@v7 with: @@ -474,14 +468,9 @@ jobs: PIP_USER: 1 run: >- PATH="${HOME}/Library/Python/3.11/bin:${HOME}/.local/bin:${PATH}" - pytest --junitxml=junit.xml --cov --timeout=0 -m autobahn + pytest --junitxml=junit.xml --cov --cov-report=xml + --timeout=0 -m autobahn shell: bash - - name: Turn coverage into xml - env: - COLOR: 'yes' - PIP_USER: 1 - run: | - python -m coverage xml - name: Upload coverage uses: codecov/codecov-action@v7 with: @@ -596,12 +585,10 @@ jobs: PIP_USER: 1 run: >- pytest tests/test_client_functional.py tests/test_http_parser.py tests/test_http_writer.py tests/test_web_functional.py tests/test_web_response.py tests/test_websocket_parser.py - --cov-config=.coveragerc-cython.toml --cov --numprocesses=auto + --cov-config=.coveragerc-cython.toml --cov --cov-report=xml + --numprocesses=auto -m 'not dev_mode and not autobahn' shell: bash - - name: Turn coverage into xml - run: | - python -m coverage xml --rcfile=.coveragerc-cython.toml - name: Upload coverage uses: codecov/codecov-action@v7 with: From 47d66e1dccf08ba5cccabc5f0f7b46c496d49d4b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:45:23 +0200 Subject: [PATCH 06/12] =?UTF-8?q?=F0=9F=A7=AA=20Drop=20ancient=20coverage?= =?UTF-8?q?=20`setup.cfg`=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.cfg | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup.cfg b/setup.cfg index cecc0c501fe..2a24abcb0cc 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,11 +34,6 @@ combine_as_imports=True known_third_party=jinja2,pytest,multidict,yarl,gunicorn,freezegun known_first_party=aiohttp,aiohttp_jinja2,aiopg -[report] -exclude_lines = - @abc.abstractmethod - @abstractmethod - [tool:pytest] addopts = # show 10 slowest invocations: From 7630a4195281620bbe5d302cc9c5c28135e86f5d Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:47:11 +0200 Subject: [PATCH 07/12] =?UTF-8?q?=F0=9F=A7=AAExclude=20packaging=20backend?= =?UTF-8?q?=20config=20from=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .coveragerc-cython.toml | 3 +++ .coveragerc.toml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.coveragerc-cython.toml b/.coveragerc-cython.toml index 59dd52a1ac4..c3e3dfb696d 100644 --- a/.coveragerc-cython.toml +++ b/.coveragerc-cython.toml @@ -56,6 +56,9 @@ disable_warnings = [ ] # https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts # dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here +omit = [ + 'setup.py', +] # NOTE: tests/autobahn/test_autobahn.py::test_{client,server} # NOTE: pass `-a|--append` to `coverage run` wich conflicts # NOTE: with `-p|--parallel-mode`. We cannot override it on diff --git a/.coveragerc.toml b/.coveragerc.toml index e15dc30c035..98adf2a6dc7 100644 --- a/.coveragerc.toml +++ b/.coveragerc.toml @@ -56,6 +56,9 @@ disable_warnings = [ ] # https://coverage.rtfd.io/en/latest/contexts.html#dynamic-contexts # dynamic_context = 'test_function' # conflicts with `pytest-cov` if set here +omit = [ + 'setup.py', +] # NOTE: tests/autobahn/test_autobahn.py::test_{client,server} # NOTE: pass `-a|--append` to `coverage run` wich conflicts # NOTE: with `-p|--parallel-mode`. We cannot override it on From 42dcfb91e9eb3967945af04fccfb4bdc22b4a4a7 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:54:29 +0200 Subject: [PATCH 08/12] =?UTF-8?q?=F0=9F=94=A7=20Unexclude=20xfailing=20tes?= =?UTF-8?q?ts=20from=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sam's convinced this helps catch bugs. We've agreed to table this for now and try to figure out a way to split the test runs on the infra level to get the best of the both worlds later. --- .coveragerc-cython.toml | 2 +- .coveragerc.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.coveragerc-cython.toml b/.coveragerc-cython.toml index c3e3dfb696d..b0d0a13a1c1 100644 --- a/.coveragerc-cython.toml +++ b/.coveragerc-cython.toml @@ -17,7 +17,7 @@ exclude_also = [ ': \.\.\.(\s*#.*)?$', '^ +\.\.\.$', 'pytest.fail\(', - '^\s*@pytest\.mark\.xfail', + # '^\s*@pytest\.mark\.xfail', # important for Dreamsorcerer ] # fail_under = 100 partial_also = [ diff --git a/.coveragerc.toml b/.coveragerc.toml index 98adf2a6dc7..4b95d7af0f4 100644 --- a/.coveragerc.toml +++ b/.coveragerc.toml @@ -17,7 +17,7 @@ exclude_also = [ ': \.\.\.(\s*#.*)?$', '^ +\.\.\.$', 'pytest.fail\(', - '^\s*@pytest\.mark\.xfail', + # '^\s*@pytest\.mark\.xfail', # important for Dreamsorcerer ] # fail_under = 100 partial_also = [ From d83589d196fdab6e55658b2c9d0466403f7b97c3 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 14 Aug 2026 23:50:58 +0200 Subject: [PATCH 09/12] =?UTF-8?q?=F0=9F=A7=AA=20Control=20coverage=20paral?= =?UTF-8?q?lel=20mode=20via=20env=20var?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 * https://discord.com/channels/267624335836053506/1253355750684753950/1537914331629486130 --- .coveragerc-cython.toml | 10 +++++++--- .coveragerc.toml | 10 +++++++--- tests/autobahn/test_autobahn.py | 22 ++++++++++++++++++++-- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.coveragerc-cython.toml b/.coveragerc-cython.toml index b0d0a13a1c1..96262659fb6 100644 --- a/.coveragerc-cython.toml +++ b/.coveragerc-cython.toml @@ -62,9 +62,13 @@ omit = [ # NOTE: tests/autobahn/test_autobahn.py::test_{client,server} # NOTE: pass `-a|--append` to `coverage run` wich conflicts # NOTE: with `-p|--parallel-mode`. We cannot override it on -# NOTE: the CLI level, which is why it's unset here. -# Ref: https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 -# parallel = true +# NOTE: the CLI level, but instead define an environment +# NOTE: variable to implement this. +# +# Refs: +# * https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 +# * https://discord.com/channels/267624335836053506/1253355750684753950/1537914331629486130 +parallel = '${COVERAGE_PARALLEL_MODE-true}' plugins = [ 'Cython.Coverage', ] diff --git a/.coveragerc.toml b/.coveragerc.toml index 4b95d7af0f4..98eb1b26e52 100644 --- a/.coveragerc.toml +++ b/.coveragerc.toml @@ -62,9 +62,13 @@ omit = [ # NOTE: tests/autobahn/test_autobahn.py::test_{client,server} # NOTE: pass `-a|--append` to `coverage run` wich conflicts # NOTE: with `-p|--parallel-mode`. We cannot override it on -# NOTE: the CLI level, which is why it's unset here. -# Ref: https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 -# parallel = true +# NOTE: the CLI level, but instead define an environment +# NOTE: variable to implement this. +# +# Refs: +# * https://discord.com/channels/267624335836053506/1253355750684753950/1537906072474488973 +# * https://discord.com/channels/267624335836053506/1253355750684753950/1537914331629486130 +parallel = '${COVERAGE_PARALLEL_MODE-true}' # plugins = [ # 'covdefaults', # ] diff --git a/tests/autobahn/test_autobahn.py b/tests/autobahn/test_autobahn.py index 1812a3a3bec..7eaf17ab528 100644 --- a/tests/autobahn/test_autobahn.py +++ b/tests/autobahn/test_autobahn.py @@ -103,7 +103,17 @@ def test_client(report_dir: Path, request: pytest.FixtureRequest) -> None: ) try: wait_for_port(9001) - subprocess.run(("coverage", "run", "-a", "tests/autobahn/client/client.py")) + subprocess.run( + ( + "coverage", + "run", + "--append", + "tests/autobahn/client/client.py", + ), + env={ + "COVERAGE_PARALLEL_MODE": "false", + }, + ) finally: autobahn_container.stop() @@ -141,7 +151,15 @@ def test_client(report_dir: Path, request: pytest.FixtureRequest) -> None: @pytest.mark.autobahn def test_server(report_dir: Path, request: pytest.FixtureRequest) -> None: server = subprocess.Popen( - ("coverage", "run", "-a", "tests/autobahn/server/server.py") + ( + "coverage", + "run", + "--append", + "tests/autobahn/server/server.py", + ), + env={ + "COVERAGE_PARALLEL_MODE": "false", + }, ) try: wait_for_port(9001) From 4ab354a3fd8560ae686f3eea64bfce0874cccc98 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 15 Aug 2026 00:03:42 +0200 Subject: [PATCH 10/12] =?UTF-8?q?=F0=9F=A7=AA=20Run=20autobahn=20tests=20u?= =?UTF-8?q?nder=20the=20same=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/autobahn/test_autobahn.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/autobahn/test_autobahn.py b/tests/autobahn/test_autobahn.py index 7eaf17ab528..deb35341b48 100644 --- a/tests/autobahn/test_autobahn.py +++ b/tests/autobahn/test_autobahn.py @@ -1,7 +1,9 @@ import json +import os import pprint import socket import subprocess +import sys import time from collections.abc import Iterator from pathlib import Path @@ -105,6 +107,8 @@ def test_client(report_dir: Path, request: pytest.FixtureRequest) -> None: wait_for_port(9001) subprocess.run( ( + sys.executable, + "-m", "coverage", "run", "--append", @@ -112,6 +116,7 @@ def test_client(report_dir: Path, request: pytest.FixtureRequest) -> None: ), env={ "COVERAGE_PARALLEL_MODE": "false", + **os.environ.copy(), }, ) finally: @@ -152,6 +157,8 @@ def test_client(report_dir: Path, request: pytest.FixtureRequest) -> None: def test_server(report_dir: Path, request: pytest.FixtureRequest) -> None: server = subprocess.Popen( ( + sys.executable, + "-m", "coverage", "run", "--append", @@ -159,6 +166,7 @@ def test_server(report_dir: Path, request: pytest.FixtureRequest) -> None: ), env={ "COVERAGE_PARALLEL_MODE": "false", + **os.environ.copy(), }, ) try: From d9068ebf15d683606538aa8471babfa2f3539288 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 15 Aug 2026 00:13:06 +0200 Subject: [PATCH 11/12] =?UTF-8?q?Revert=20"=F0=9F=A7=AA=20Unspecialize=20`?= =?UTF-8?q?coverage.xml`=20name=20in=20cython=20job"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit e71dbf033dc276ca3b1cc47f58b95c7bacc1cf9b. --- .github/workflows/ci-cd.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index e6ef440879f..e38f292a472 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -585,14 +585,15 @@ jobs: PIP_USER: 1 run: >- pytest tests/test_client_functional.py tests/test_http_parser.py tests/test_http_writer.py tests/test_web_functional.py tests/test_web_response.py tests/test_websocket_parser.py - --cov-config=.coveragerc-cython.toml --cov --cov-report=xml + --cov-config=.coveragerc-cython.toml --cov + --cov-report=xml:cython-coverage.xml --numprocesses=auto -m 'not dev_mode and not autobahn' shell: bash - name: Upload coverage uses: codecov/codecov-action@v7 with: - files: ./coverage.xml + files: ./cython-coverage.xml disable_search: true flags: cython-coverage token: ${{ secrets.CODECOV_TOKEN }} From c1b13b457b67b9076d8d68c31ebc643f577bee15 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Sat, 15 Aug 2026 01:33:41 +0200 Subject: [PATCH 12/12] =?UTF-8?q?=F0=9F=93=9D=20Add=20a=20change=20note=20?= =?UTF-8?q?for=20PR=20#13422?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES/13422.contrib.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CHANGES/13422.contrib.rst diff --git a/CHANGES/13422.contrib.rst b/CHANGES/13422.contrib.rst new file mode 100644 index 00000000000..71f97d67e4a --- /dev/null +++ b/CHANGES/13422.contrib.rst @@ -0,0 +1,17 @@ +Synchronized the ``coverage.py`` configuration (:file:`.coveragerc.toml` and +:file:`.coveragerc-cython.toml`) with the pattern already established in +:external+yarl:doc:`yarl `, :external+multidict:doc:`multidict +`, ``frozenlist`` and other sibling projects +-- by :user:`webknjaz`. + +Both files now anchor package discovery through ``source_pkgs`` instead of +relying on a same-named directory happening to exist relative to the +working directory, and add a ``[paths]`` mapping so coverage recorded +against an installed copy of ``aiohttp`` still combines correctly with +coverage recorded from the Git checkout. CI now lets ``pytest-cov`` write +``coverage.xml`` directly via ``--cov-report=xml`` instead of a separate +``coverage xml`` step, and the Autobahn testsuite's subprocess-based +coverage collection (which uses ``coverage run --append``, incompatible +with parallel mode) now opts out per-invocation via a +``COVERAGE_PARALLEL_MODE`` environment variable instead of trying to +override it on the command line.