From a4cf38ab57f167d970479eb83df35a7f6338eba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 26 Nov 2024 14:27:33 +0100 Subject: [PATCH 1/5] MAINT: remove python3.8 support --- .github/workflows/publish.yml | 2 +- .github/workflows/python-tests.yml | 30 +++++++++--------------------- CHANGES.rst | 1 + setup.cfg | 3 +-- tox.ini | 2 +- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 49eed10..1988b9e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: - python-version: 3.8 + python-version: 3.10 - name: Install python-build and twine run: python -m pip install build "twine>=3.3" diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index b7ff7f1..91983dd 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -20,26 +20,17 @@ jobs: matrix: include: - os: ubuntu-latest - python-version: '3.8' - toxenv: py38-test-pytestoldest + python-version: '3.9' + toxenv: py39-test-pytestoldest - os: windows-latest - python-version: '3.8' - toxenv: py38-test-pytest50 + python-version: '3.9' + toxenv: py39-test-pytest50 - os: macos-13 - python-version: '3.8' - toxenv: py38-test-pytest51 - - os: ubuntu-latest - python-version: '3.8' - toxenv: py38-test-pytest52 - - os: windows-latest - python-version: '3.8' - toxenv: py38-test-pytest53 - - os: ubuntu-latest - python-version: '3.8' - toxenv: py38-test-pytest60 + python-version: '3.9' + toxenv: py39-test-pytest51 - os: ubuntu-latest python-version: '3.9' - toxenv: py39-test-pytest61 + toxenv: py39-test-pytest60 - os: ubuntu-latest python-version: '3.9' toxenv: py39-test-pytest62 @@ -74,14 +65,11 @@ jobs: python-version: '3.13' toxenv: py313-test-pytestdev - os: macos-latest - python-version: '3.11' - toxenv: py311-test-pytestdev - - os: ubuntu-latest python-version: '3.12' - toxenv: py312-test-pytestdev-numpydev + toxenv: py312-test-pytestdev - os: ubuntu-latest python-version: '3.13' - toxenv: py313-test-pytestdev + toxenv: py313-test-pytestdev-numpydev steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 diff --git a/CHANGES.rst b/CHANGES.rst index 342d82e..8fe4a45 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,7 @@ 1.4.0 (unreleased) ================== +- Versions of Python <3.9 are no longer supported. [#274] 1.3.0 (2024-11-25) ================== diff --git a/setup.cfg b/setup.cfg index 5efdeb4..4d95b5b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,7 +11,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 @@ -29,7 +28,7 @@ keywords = doctest, rst, pytest, py.test [options] zip_safe = False packages = find: -python_requires = >=3.8 +python_requires = >=3.9 setup_requires = setuptools_scm install_requires = diff --git a/tox.ini b/tox.ini index 3661c92..eb158a0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310,311,312,313}-test + py{39,310,311,312,313}-test codestyle requires = setuptools >= 30.3.0 From 62ea1491c6d83841505ed29cdbd9791e4e4a8557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 26 Nov 2024 14:55:38 +0100 Subject: [PATCH 2/5] MAINT: run pyupgrade --- pytest_doctestplus/output_checker.py | 14 +++++++------- pytest_doctestplus/plugin.py | 6 +++--- tests/python/doctests.py | 4 ++-- tests/test_doctestplus.py | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pytest_doctestplus/output_checker.py b/pytest_doctestplus/output_checker.py index 83b6c23..53dd6f5 100644 --- a/pytest_doctestplus/output_checker.py +++ b/pytest_doctestplus/output_checker.py @@ -67,13 +67,13 @@ def __init__(self): front_sep = r'\s|[*+-,<=(\[]' back_sep = front_sep + r'|[>j)\]}]' - fbeg = r'^{}(?={}|$)'.format(got_floats, back_sep) - fmidend = r'(?<={}){}(?={}|$)'.format(front_sep, got_floats, back_sep) - self.num_got_rgx = re.compile(r'({}|{})'.format(fbeg, fmidend)) + fbeg = fr'^{got_floats}(?={back_sep}|$)' + fmidend = fr'(?<={front_sep}){got_floats}(?={back_sep}|$)' + self.num_got_rgx = re.compile(fr'({fbeg}|{fmidend})') - fbeg = r'^{}(?={}|$)'.format(want_floats, back_sep) - fmidend = r'(?<={}){}(?={}|$)'.format(front_sep, want_floats, back_sep) - self.num_want_rgx = re.compile(r'({}|{})'.format(fbeg, fmidend)) + fbeg = fr'^{want_floats}(?={back_sep}|$)' + fmidend = fr'(?<={front_sep}){want_floats}(?={back_sep}|$)' + self.num_want_rgx = re.compile(fr'({fbeg}|{fmidend})') # As of 2023-09-26, Python base class has no init, but just in case # it acquires one. @@ -220,7 +220,7 @@ def normalize_floats(self, want, got, flags): # blank line, unless the DONT_ACCEPT_BLANKLINE flag is used. if not (flags & doctest.DONT_ACCEPT_BLANKLINE): # Replace in want with a blank line. - want = re.sub(r'(?m)^{}\s*?$'.format(re.escape(doctest.BLANKLINE_MARKER)), + want = re.sub(fr'(?m)^{re.escape(doctest.BLANKLINE_MARKER)}\s*?$', '', want) # If a line in got contains only spaces, then remove the # spaces. diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 5d8f6d9..5290dd9 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -893,7 +893,7 @@ def write_modified_file(fname, new_fname, changes): changes.sort(key=lambda x: (x["test_lineno"], x["example_lineno"]), reverse=True) - with open(fname, "r") as f: + with open(fname) as f: text = f.readlines() for change in changes: @@ -923,7 +923,7 @@ def write_modified_file(fname, new_fname, changes): def pytest_terminal_summary(terminalreporter, exitstatus, config): changesets = DebugRunnerPlus._changesets diff_mode = DebugRunnerPlus._generate_diff - DebugRunnerPlus._changesets = defaultdict(lambda: []) + DebugRunnerPlus._changesets = defaultdict(list) DebugRunnerPlus._generate_diff = None all_bad_tests = [] if not diff_mode: @@ -1004,7 +1004,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): class DebugRunnerPlus(doctest.DebugRunner): - _changesets = defaultdict(lambda: []) + _changesets = defaultdict(list) _generate_diff = False def __init__(self, checker=None, verbose=None, optionflags=0, diff --git a/tests/python/doctests.py b/tests/python/doctests.py index 391fd96..90fe83e 100644 --- a/tests/python/doctests.py +++ b/tests/python/doctests.py @@ -80,7 +80,7 @@ def depends_on_two_modules(): """ -class ClassWithSomeBadDocTests(object): +class ClassWithSomeBadDocTests: def this_test_works(): """ This test should be executed by --doctest-plus and should pass. @@ -98,7 +98,7 @@ def this_test_fails(): """ -class ClassWithAllBadDocTests(object): +class ClassWithAllBadDocTests: def this_test_fails(self): """ This test will cause a failure if __doctest_skip__ is not working. diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index 069a0d5..86cae98 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -314,7 +314,7 @@ def test_normalize_with_ellipsis(self): c = OutputChecker() got = [] for char in ['A', 'B', 'C', 'D', 'E']: - got.append('%s %s' % (char, float(ord(char)))) + got.append('{} {}'.format(char, float(ord(char)))) got = '\n'.join(got) want = "A 65.0\nB 66.0\n...G 70.0" From 8fc2381414c73059055a17f7cd1b22adbd692bf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 26 Nov 2024 07:30:31 -0800 Subject: [PATCH 3/5] Update .github/workflows/publish.yml Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com> --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1988b9e..1f49c5d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: - python-version: 3.10 + python-version: '3.10' - name: Install python-build and twine run: python -m pip install build "twine>=3.3" From 505f059692a870fbd6f429e1efc4371725f80e4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 16 Dec 2024 18:49:17 -0800 Subject: [PATCH 4/5] MAINT: one more f-string --- tests/test_doctestplus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index 86cae98..a88ca7b 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -314,7 +314,7 @@ def test_normalize_with_ellipsis(self): c = OutputChecker() got = [] for char in ['A', 'B', 'C', 'D', 'E']: - got.append('{} {}'.format(char, float(ord(char)))) + got.append(f'{char} {float(ord(char))}') got = '\n'.join(got) want = "A 65.0\nB 66.0\n...G 70.0" From 23eb3de76bc4581dfc8261b07a8a55cc03fea45b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 16 Dec 2024 19:05:07 -0800 Subject: [PATCH 5/5] TST: one more version to xfail --- tests/test_doctestplus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index a88ca7b..fb0ac37 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1142,7 +1142,7 @@ def f(): @pytest.mark.xfail( - python_version() in ('3.11.9', '3.11.10', '3.12.3'), + python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.12.3'), reason='broken by https://github.com/python/cpython/pull/115440') def test_ufunc(testdir): pytest.importorskip('numpy')