diff --git a/CHANGES/12620.contrib.rst b/CHANGES/12620.contrib.rst new file mode 100644 index 00000000000..b93594993d0 --- /dev/null +++ b/CHANGES/12620.contrib.rst @@ -0,0 +1,2 @@ +Moved pytest config from :file:`setup.cfg` to :file:`pytest.ini` +-- by :user:`aiolibsbot`. diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000000..b01e0e183f2 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,110 @@ +[pytest] +addopts = + # Show 10 slowest invocations: + --durations=10 + + # 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 + *.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.