From 64f6580bf377ba54d293599858a96c8573717bd3 Mon Sep 17 00:00:00 2001 From: Pravin <91125540+p-r-a-v-i-n@users.noreply.github.com> Date: Thu, 5 Feb 2026 19:32:12 +0530 Subject: [PATCH] Update pytest versions (#9881) * Update pytest versions * Ignore deprecation warnings from coreapi * ignore coreapi deprecation warnings during test startup * Use pytest directly in tox and relax version pins --- pyproject.toml | 9 ++++++--- tox.ini | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6613f1a66..1915d9444 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,8 +49,8 @@ test = [ "importlib-metadata<5.0", # Pytest for running the tests. - "pytest>=7.0.1,<8", - "pytest-cov>=4.0.0,<5.0", + "pytest==9.*", + "pytest-cov==7.*", "pytest-django>=4.5.2,<5", # Remove when dropping support for Django<5.0 @@ -118,7 +118,10 @@ keep_full_version = true [tool.pytest.ini_options] addopts = "--tb=short --strict-markers -ra" testpaths = [ "tests" ] -filterwarnings = [ "ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF318Warning" ] +filterwarnings = [ + "ignore:CoreAPI compatibility is deprecated*:rest_framework.RemovedInDRF318Warning", + "ignore:'cgi' is deprecated:DeprecationWarning", +] [tool.coverage.run] # NOTE: source is ignored with pytest-cov (but uses the same). diff --git a/tox.ini b/tox.ini index b13eabd1a..00e5bd57b 100644 --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ envlist = docs [testenv] -commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --coverage {posargs} +commands = pytest --cov --cov-report xml {posargs} envdir = {toxworkdir}/venvs/{envname} setenv = PYTHONDONTWRITEBYTECODE=1