From a0ef9e723dac2ca1004b702c5361379544ae619e Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Mon, 18 May 2026 14:03:26 +0000 Subject: [PATCH 1/8] Move pytest configuration into a dedicated pytest.ini --- CHANGES/12620.contrib.rst | 3 + pytest.ini | 116 ++++++++++++++++++++++++++++++++++++++ setup.cfg | 65 --------------------- 3 files changed, 119 insertions(+), 65 deletions(-) create mode 100644 CHANGES/12620.contrib.rst create mode 100644 pytest.ini diff --git a/CHANGES/12620.contrib.rst b/CHANGES/12620.contrib.rst new file mode 100644 index 00000000000..0ae2bb7d47a --- /dev/null +++ b/CHANGES/12620.contrib.rst @@ -0,0 +1,3 @@ +Moved the pytest configuration out of ``setup.cfg`` into a dedicated +``pytest.ini`` file, aligning the layout with other aio-libs projects +-- by :user:`aiolibsbot`. diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000000..d4e9b9303f5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,116 @@ +[pytest] +addopts = + # `pytest-xdist`: + --numprocesses=auto + + # Show 10 slowest invocations: + --durations=10 + + # A bit of verbosity doesn't hurt: + -v + + # Report all the things == -rxXs: + -ra + + # Show values of the local vars in errors/tracebacks: + --showlocals + + # Fail on config parsing warnings: + # --strict-config + + # Fail on non-existing markers: + # * Deprecated since v6.2.0 but may be reintroduced later covering a + # broader scope: + # --strict + # * Exists since v4.5.0 (advised to be used instead of `--strict`): + --strict-markers + + # Skip dev_mode/autobahn/internal tests by default; CI opts in explicitly: + -m "not dev_mode and not autobahn and not internal" + + # Disable entry-point auto-load, otherwise we miss coverage: + -p no:aiohttp + +asyncio_mode = auto + +doctest_optionflags = ALLOW_UNICODE ELLIPSIS + +# Marks tests with an empty parameterset as xfail(run=False) +empty_parameter_set_mark = xfail + +faulthandler_timeout = 30 + +filterwarnings = + error + ignore:module 'ssl' has no attribute 'OP_NO_COMPRESSION'. The Python interpreter is compiled against OpenSSL < 1.0.0. Ref. https.//docs.python.org/3/library/ssl.html#ssl.OP_NO_COMPRESSION:UserWarning + ignore:Unclosed client session 2022.06.15`. + ignore:path is deprecated. Use files.. instead. Refer to https.//importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.:DeprecationWarning:certifi.core + # Dateutil deprecation warning already fixed upstream. + # Can be dropped with the next release, `dateutil > 2.8.2` + # https://github.com/dateutil/dateutil/pull/1285 + ignore:datetime.*utcfromtimestamp\(\) is deprecated and scheduled for removal:DeprecationWarning:dateutil.tz.tz + # Tracked upstream and waiting for PR review + # https://github.com/spulec/freezegun/issues/508 + # https://github.com/spulec/freezegun/pull/511 + ignore:datetime.*utcnow\(\) is deprecated and scheduled for removal:DeprecationWarning:freezegun.api + # Weird issue in Python 3.13+ triggered in test_multipart.py + ignore:coroutine method 'aclose' of 'BodyPartReader._decode_content_async' was never awaited:RuntimeWarning + # uvloop 0.22+ accesses the deprecated asyncio.AbstractEventLoopPolicy + # alias, which Python 3.14 marks for removal in 3.16. Drop this when + # uvloop stops touching the deprecated alias. + ignore:'asyncio.AbstractEventLoopPolicy' is deprecated:DeprecationWarning:uvloop + +# https://docs.pytest.org/en/stable/usage.html#creating-junitxml-format-files +junit_duration_report = call +# xunit1 contains more metadata than xunit2 so it's better for CI UIs: +junit_family = xunit1 +junit_logging = all +junit_log_passing_tests = true +junit_suite_name = aiohttp_test_suite + +# A mapping of markers to their descriptions allowed in strict mode: +markers = + autobahn: Autobahn testsuite. Should be run as a separate job. + dev_mode: mark test to run in dev mode. + internal: tests which may cause issues for packagers, but should be run in aiohttp's CI. + skip_blockbuster: mark test to skip the blockbuster fixture. + +minversion = 6.2 + +# Optimize pytest's lookup by restricting potentially deep dir tree scan: +norecursedirs = + build + dist + docs + requirements + vendor + venv + virtualenv + aiohttp.egg-info + .cache + .eggs + .git + .github + .tox + *.egg + +testpaths = tests/ + +# 2-minute per-test timeout so a hung test surfaces by name instead of taking +# down the whole job. Autobahn and benchmark jobs override with `--timeout=0`. +timeout = 120 + +xfail_strict = true diff --git a/setup.cfg b/setup.cfg index e78606ecd57..85291ec62ad 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,68 +38,3 @@ known_first_party=aiohttp,aiohttp_jinja2,aiopg exclude_lines = @abc.abstractmethod @abstractmethod - -[tool:pytest] -addopts = - # show 10 slowest invocations: - --durations=10 - - # a bit of verbosity doesn't hurt: - -v - - # report all the things == -rxXs: - -ra - - # show values of the local vars in errors: - --showlocals - - -m "not dev_mode and not autobahn and not internal" - - # Disable entry-point auto-load, otherwise we miss coverage. - -p no:aiohttp -asyncio_mode = auto -# 2-minute per-test timeout so a hung test surfaces by name instead of taking -# down the whole job. Autobahn and benchmark jobs override with `--timeout=0`. -timeout = 120 -filterwarnings = - error - ignore:module 'ssl' has no attribute 'OP_NO_COMPRESSION'. The Python interpreter is compiled against OpenSSL < 1.0.0. Ref. https.//docs.python.org/3/library/ssl.html#ssl.OP_NO_COMPRESSION:UserWarning - ignore:Unclosed client session 2022.06.15`. - ignore:path is deprecated. Use files.. instead. Refer to https.//importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.:DeprecationWarning:certifi.core - # Dateutil deprecation warning already fixed upstream. - # Can be dropped with the next release, `dateutil > 2.8.2` - # https://github.com/dateutil/dateutil/pull/1285 - ignore:datetime.*utcfromtimestamp\(\) is deprecated and scheduled for removal:DeprecationWarning:dateutil.tz.tz - # Tracked upstream and waiting for PR review - # https://github.com/spulec/freezegun/issues/508 - # https://github.com/spulec/freezegun/pull/511 - ignore:datetime.*utcnow\(\) is deprecated and scheduled for removal:DeprecationWarning:freezegun.api - # Weird issue in Python 3.13+ triggered in test_multipart.py - ignore:coroutine method 'aclose' of 'BodyPartReader._decode_content_async' was never awaited:RuntimeWarning - # uvloop 0.22+ accesses the deprecated asyncio.AbstractEventLoopPolicy - # alias, which Python 3.14 marks for removal in 3.16. Drop this when - # uvloop stops touching the deprecated alias. - ignore:'asyncio.AbstractEventLoopPolicy' is deprecated:DeprecationWarning:uvloop -junit_suite_name = aiohttp_test_suite -norecursedirs = dist docs build .tox .eggs -minversion = 3.8.2 -testpaths = tests/ -xfail_strict = true -markers = - autobahn: Autobahn testsuite. Should be run as a separate job. - dev_mode: mark test to run in dev mode. - internal: tests which may cause issues for packagers, but should be run in aiohttp's CI. - skip_blockbuster: mark test to skip the blockbuster fixture. From 77f73f96b68d826f0cb94a6ed4493b6cc2628bd2 Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Mon, 18 May 2026 14:21:54 +0000 Subject: [PATCH 2/8] Quote aio-libs in 12620 fragment to satisfy spell check --- CHANGES/12620.contrib.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES/12620.contrib.rst b/CHANGES/12620.contrib.rst index 0ae2bb7d47a..12ced75d138 100644 --- a/CHANGES/12620.contrib.rst +++ b/CHANGES/12620.contrib.rst @@ -1,3 +1,3 @@ Moved the pytest configuration out of ``setup.cfg`` into a dedicated -``pytest.ini`` file, aligning the layout with other aio-libs projects --- by :user:`aiolibsbot`. +``pytest.ini`` file, aligning the layout with other ``aio-libs`` +projects -- by :user:`aiolibsbot`. From cfb2d75ce4ea0ef1e5b370a33a9127f298465291 Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Mon, 18 May 2026 15:09:25 +0000 Subject: [PATCH 3/8] rebase: apply review feedback on #12621 --- CHANGES/12620.contrib.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGES/12620.contrib.rst b/CHANGES/12620.contrib.rst index 12ced75d138..b93594993d0 100644 --- a/CHANGES/12620.contrib.rst +++ b/CHANGES/12620.contrib.rst @@ -1,3 +1,2 @@ -Moved the pytest configuration out of ``setup.cfg`` into a dedicated -``pytest.ini`` file, aligning the layout with other ``aio-libs`` -projects -- by :user:`aiolibsbot`. +Moved pytest config from :file:`setup.cfg` to :file:`pytest.ini` +-- by :user:`aiolibsbot`. From 334d5de996c31900ed50be08a3a30efba7116415 Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Mon, 18 May 2026 15:17:19 +0000 Subject: [PATCH 4/8] fix: resolve pre-existing CI failures on #12621 --- pytest.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/pytest.ini b/pytest.ini index d4e9b9303f5..b5e94dac3bf 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,8 +1,5 @@ [pytest] addopts = - # `pytest-xdist`: - --numprocesses=auto - # Show 10 slowest invocations: --durations=10 From eb5f3ade14b5347a5579f473649d2dbb9f1d149f Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Mon, 18 May 2026 19:35:28 +0000 Subject: [PATCH 5/8] rebase: apply review feedback on #12621 --- pytest.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/pytest.ini b/pytest.ini index b5e94dac3bf..db9c95ef99a 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,9 +3,6 @@ addopts = # Show 10 slowest invocations: --durations=10 - # A bit of verbosity doesn't hurt: - -v - # Report all the things == -rxXs: -ra From 5d02dbdd8d7bcf64a6ac457ea50a4504c64f03de Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 19 May 2026 13:56:27 +0100 Subject: [PATCH 6/8] Update pytest.ini --- pytest.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index db9c95ef99a..cdab4b78fe3 100644 --- a/pytest.ini +++ b/pytest.ini @@ -22,8 +22,8 @@ addopts = # Skip dev_mode/autobahn/internal tests by default; CI opts in explicitly: -m "not dev_mode and not autobahn and not internal" - # Disable entry-point auto-load, otherwise we miss coverage: - -p no:aiohttp + # Load pytest-cov eagerly, otherwise we miss coverage from pytest-aiohttp entry-point: + -p pytest_cov asyncio_mode = auto From 2e00f683d613c265d9cb9ba955bfb4d3dd5e90cc Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 19 May 2026 13:59:42 +0100 Subject: [PATCH 7/8] Revert --- pytest.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytest.ini b/pytest.ini index cdab4b78fe3..4ed94f1c0d4 100644 --- a/pytest.ini +++ b/pytest.ini @@ -22,8 +22,8 @@ addopts = # Skip dev_mode/autobahn/internal tests by default; CI opts in explicitly: -m "not dev_mode and not autobahn and not internal" - # Load pytest-cov eagerly, otherwise we miss coverage from pytest-aiohttp entry-point: - -p pytest_cov + # Disable entry-point auto-load, otherwise we miss coverage. + -p no:aiohttp asyncio_mode = auto From e9fd5832859ac9ecf54ef464ec6b61cae6e950af Mon Sep 17 00:00:00 2001 From: aiolibsbot Date: Tue, 19 May 2026 17:47:18 +0000 Subject: [PATCH 8/8] rebase: apply review feedback on #12621 --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 4ed94f1c0d4..b01e0e183f2 100644 --- a/pytest.ini +++ b/pytest.ini @@ -93,7 +93,7 @@ norecursedirs = vendor venv virtualenv - aiohttp.egg-info + *.egg-info .cache .eggs .git