Xqt has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1272690?usp=email )

Change subject: pytest: set pytest minversion to 9.0.3
......................................................................

pytest: set pytest minversion to 9.0.3

A vulnerability was found for pytest < 9.0.3. However pytest 9.0.3
and later require Python 3.10.

Some tests depends on pytest since it uses pytest-attrib to select
test classes by its attributes or it runs doctests. Therefore those
tests should not be run with Python 3.9.

Bug: T423568
Change-Id: If3c19765e16114fef0cdf3e60a243e30170c8e49
---
M .github/workflows/doctest.yml
M .github/workflows/graalpy_tests.yml
M .github/workflows/pywikibot-ci.yml
M .github/workflows/sysop_write_tests-ci.yml
M dev-requirements.txt
M docs/tests_ref/pytest.rst
M tests/README.rst
M tox.ini
8 files changed, 28 insertions(+), 25 deletions(-)

Approvals:
  Xqt: Verified; Looks good to me, approved




diff --git a/.github/workflows/doctest.yml b/.github/workflows/doctest.yml
index 75415f4..0987132 100644
--- a/.github/workflows/doctest.yml
+++ b/.github/workflows/doctest.yml
@@ -21,12 +21,12 @@
     strategy:
       fail-fast: false
       matrix:
-        python-version: [pypy3.9, pypy3.11, '3.9', '3.10', '3.11', '3.12', 
'3.13', '3.14']
+        python-version: [pypy3.11, '3.10', '3.11', '3.12', '3.13', '3.14']
         os: ['windows-latest', 'macOS-latest', 'ubuntu-latest']
         include:
           - python-version: 3.15-dev
         exclude:  # Test already made on Jenkins
-          - python-version: '3.9'
+          - python-version: '3.10'
             os: ubuntu-latest
           - python-version: '3.14'
             os: ubuntu-latest
@@ -49,7 +49,7 @@
           pip install mwparserfromhell
           pip install packaging
           pip install PyMySQL
-          pip install "pytest != 9.0.0"
+          pip install "pytest >= 9.0.3"
           pip install requests-sse
           pip install wikitextparser
       - name: Generate user files
diff --git a/.github/workflows/graalpy_tests.yml 
b/.github/workflows/graalpy_tests.yml
index bbd43d0..79e7298 100644
--- a/.github/workflows/graalpy_tests.yml
+++ b/.github/workflows/graalpy_tests.yml
@@ -44,7 +44,7 @@
           pip install packaging
           pip install requests
           pip install wikitextparser
-          pip install pytest
+          pip install pytest >= 9.0.3
           pip install pytest-attrib
           pip install coverage
       - name: Generate user files
diff --git a/.github/workflows/pywikibot-ci.yml 
b/.github/workflows/pywikibot-ci.yml
index b244f95..6854485 100644
--- a/.github/workflows/pywikibot-ci.yml
+++ b/.github/workflows/pywikibot-ci.yml
@@ -129,7 +129,9 @@
           PYTHON_GIL: ${{ endsWith(matrix.python-version, 't') && '0' || '1' }}
         run: |
           python pwb.py version
-          if [ ${{matrix.site || 0}} != 'wikisource:zh' ]; then
+          if [ "${{ matrix.site }}" != "wikisource:zh" ] ||
+             [ "${{ matrix.python-version }}" = "pypy3.9" ] ||
+             [ "${{ matrix.python-version }}" = "3.9" ]; then
             coverage run -m unittest discover -vv -p \"*_tests.py\";
           else
             coverage run -m pytest
diff --git a/.github/workflows/sysop_write_tests-ci.yml 
b/.github/workflows/sysop_write_tests-ci.yml
index 30a883e..056c4b2 100644
--- a/.github/workflows/sysop_write_tests-ci.yml
+++ b/.github/workflows/sysop_write_tests-ci.yml
@@ -22,7 +22,7 @@
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.9']
+        python-version: ['3.10']
         site: ['wikipedia:test']
         attr: [write and not rights, write and rights, rights and not write]
     steps:
diff --git a/dev-requirements.txt b/dev-requirements.txt
index 4e0c256..e8610da 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,13 +1,11 @@
 # This is a requirements file for development dependencies.
 #
-
-pytest >= 9.0.2; python_version > "3.9"
-pytest == 8.4.2; python_version == "3.9"
+# Python 3.10 is required for pytest and pre-commit
+pytest >= 9.0.3; python_version > "3.9"
 pytest-subtests >= 0.15.0; python_version == "3.9"
 pytest-attrib >= 0.1.3
 pytest-xvfb>=3.1.1

-# Python 3.10 is required for pre-commit
 pre-commit >= 4.5.1; python_version > "3.9"
 coverage>=7.13.1; python_version > "3.9"
 coverage==7.10.7; python_version == "3.9"
diff --git a/docs/tests_ref/pytest.rst b/docs/tests_ref/pytest.rst
index 5a3d69e..5d062af 100644
--- a/docs/tests_ref/pytest.rst
+++ b/docs/tests_ref/pytest.rst
@@ -1,6 +1,6 @@
-*************************
-pytest mypy plugin module
-*************************
+********************
+pytest plugin module
+********************

 .. automodule:: conftest
     :members:
diff --git a/tests/README.rst b/tests/README.rst
index 6d215b9..41de0ce 100644
--- a/tests/README.rst
+++ b/tests/README.rst
@@ -30,9 +30,11 @@

 **pytest**

+.. note:: Python 3.10 or higher is required to run pytest.
+
 ::

-    pip install "pytest != 9.0.0"
+    pip install "pytest >= 9.0.3"
     pytest

 **tox**
diff --git a/tox.ini b/tox.ini
index 42de004..d72b15f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,8 @@
     py312: python3.12
     py313: python3.13
     py314: python3.14
-    pypy: pypy3
+    # temporary until job is removed or T423607 is solved
+    pypy: python3.11
 setenv =
     VIRTUAL_ENV={envdir}
     PRE_COMMIT_COLOR=always
@@ -49,18 +50,18 @@
 deps =
     lint: pre-commit

-    fasttest: pytest != 9.0.0
+    fasttest: pytest >= 9.0.3
     fasttest: pytest-attrib
     fasttest: .[scripts]

-    fasttest-py39: .[html]
-    fasttest-py39: pytest-subtests
-    fasttest-py310: .[wikitextparser]
+    fasttest-py310: .[html]
+    fasttest-py310: pytest-subtests
+    fasttest-py311: .[wikitextparser]

     deeptest: .[html]
     deeptest: .[scripts]
     deeptest-py314: .[wikitextparser]
-    deeptest-py314: pytest >= 9.0.1
+    deeptest-py314: pytest >= 9.0.3

 [testenv:typing]
 basepython = python3.9
@@ -79,7 +80,7 @@

 [doctest]
 deps =
-    pytest != 9.0.0
+    pytest >= 9.0.3
     wikitextparser
     .[eventstreams]
     .[mysql]
@@ -90,11 +91,11 @@
 allowlist_externals = tox
 deps =
 commands =
-    tox -e doctest-py39
+    tox -e doctest-py310
     tox -e doctest-py314

-[testenv:doctest-py39]
-basepython = python3.9
+[testenv:doctest-py310]
+basepython = python3.10
 commands =
     python {[params]generate_user_files}
     python {[params]MAXLAG}
@@ -248,6 +249,6 @@


 [pytest]
-minversion = 8.4.2
+minversion = 9.0.3
 testpaths = tests
 python_files = *_tests.py

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1272690?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If3c19765e16114fef0cdf3e60a243e30170c8e49
Gerrit-Change-Number: 1272690
Gerrit-PatchSet: 7
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to