From 250d3c3b65ffcf269c19cfac1af3448d6673a4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 27 Jan 2025 15:10:12 -0800 Subject: [PATCH 01/30] Back to development: v1.5.0.dev --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 4e4d97b..c972289 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,8 @@ +1.5.0 (unreleased) +================== + + + 1.4.0 (2025-01-24) ================== From c28a4224845bd72e8217b9803f8ad6c6515b4367 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 16:08:46 +0000 Subject: [PATCH 02/30] Bump the actions group in /.github/workflows with 2 updates Bumps the actions group in /.github/workflows with 2 updates: [actions/setup-python](https://github.com/actions/setup-python) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `actions/setup-python` from 5.3.0 to 5.4.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/0b93645e9fea7318ecaed2b359559ac225c90a2b...42375524e23c412d93fb67b49958b491fce71c38) Updates `pypa/gh-action-pypi-publish` from 1.12.3 to 1.12.4 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/67339c736fd9354cd4f8cb0b744f2b82a74b5c70...76f52bc884231f62b9a034ebfe128415bbaabdfc) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 4 ++-- .github/workflows/python-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7b569d0..7a6904c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: '3.10' @@ -46,7 +46,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 + uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 8bbb8b9..bab577c 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: python-version: ${{ matrix.python-version }} - name: Install Tox From cc0144a0a4161d2f988e8627c75bca366bc79b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Tue, 18 Mar 2025 20:57:03 +0100 Subject: [PATCH 03/30] introduced option to specify file encoding --- pytest_doctestplus/plugin.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 6487da7..146079a 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -111,6 +111,10 @@ def pytest_addoption(parser): "Options accepted are 'txt', 'tex', and 'rst'. " "This is no longer recommended, use --doctest-glob instead." )) + + parser.addoption("--text-file-encoding", action="store", + help="Specify encoding for files.", + default="utf-8") # Defaults to `atol` parameter from `numpy.allclose`. parser.addoption("--doctest-plus-atol", action="store", @@ -142,6 +146,9 @@ def pytest_addoption(parser): parser.addini("text_file_format", "Default format for docs. " "This is no longer recommended, use --doctest-glob instead.") + + parser.addini("text_file_encoding", + "Default encoding for text files.", default=None) parser.addini("doctest_optionflags", "option flags for doctests", type="args", default=["ELLIPSIS", "NORMALIZE_WHITESPACE"],) @@ -912,13 +919,13 @@ def test_filter(test): return tests -def write_modified_file(fname, new_fname, changes): +def write_modified_file(fname, new_fname, changes, encoding=None): # Sort in reversed order to edit the lines: bad_tests = [] changes.sort(key=lambda x: (x["test_lineno"], x["example_lineno"]), reverse=True) - with open(fname) as f: + with open(fname, encoding=encoding) as f: text = f.readlines() for change in changes: @@ -939,7 +946,7 @@ def write_modified_file(fname, new_fname, changes): text[lineno:lineno+want.count("\n")] = [got] - with open(new_fname, "w") as f: + with open(new_fname, "w", encoding=encoding) as f: f.write("".join(text)) return bad_tests @@ -953,6 +960,9 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): all_bad_tests = [] if not diff_mode: return # we do not report or apply diffs + + # get encoding to open file default ini=None or option="utf-8" + encoding = config.getini("text_file_encoding") or config.getoption("text_file_encoding") if diff_mode != "overwrite": # In this mode, we write a corrected file to a temporary folder in @@ -974,7 +984,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): new_fname = fname.replace(common_path, tmpdirname) os.makedirs(os.path.split(new_fname)[0], exist_ok=True) - bad_tests = write_modified_file(fname, new_fname, changes) + bad_tests = write_modified_file(fname, new_fname, changes, encoding) all_bad_tests.extend(bad_tests) # git diff returns 1 to signal changes, so just ignore the @@ -1013,7 +1023,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): return terminalreporter.write_line("Applied fix to the following files:") for fname, changes in changesets.items(): - bad_tests = write_modified_file(fname, fname, changes) + bad_tests = write_modified_file(fname, fname, changes, encoding) all_bad_tests.extend(bad_tests) terminalreporter.write_line(f" {fname}") From a872339b0255f6bb548218db66b009128689d7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Tue, 18 Mar 2025 23:51:02 +0100 Subject: [PATCH 04/30] fix codestyle violations --- pytest_doctestplus/plugin.py | 8 ++++---- pytest_doctestplus/utils.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 146079a..e091cc1 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -111,7 +111,7 @@ def pytest_addoption(parser): "Options accepted are 'txt', 'tex', and 'rst'. " "This is no longer recommended, use --doctest-glob instead." )) - + parser.addoption("--text-file-encoding", action="store", help="Specify encoding for files.", default="utf-8") @@ -146,7 +146,7 @@ def pytest_addoption(parser): parser.addini("text_file_format", "Default format for docs. " "This is no longer recommended, use --doctest-glob instead.") - + parser.addini("text_file_encoding", "Default encoding for text files.", default=None) @@ -451,7 +451,7 @@ def parse(self, s, name=None): continue if config.getoption('remote_data', 'none') != 'any': - if any(re.match(fr'{comment_char}\s+doctest-remote-data-all\s*::', x.strip()) + if any(re.match(fr'{comment_char}\s+doctest-remote-data-all\s*::', x.strip()) # noqa: E501 for x in lines): skip_all = True continue @@ -960,7 +960,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): all_bad_tests = [] if not diff_mode: return # we do not report or apply diffs - + # get encoding to open file default ini=None or option="utf-8" encoding = config.getini("text_file_encoding") or config.getoption("text_file_encoding") diff --git a/pytest_doctestplus/utils.py b/pytest_doctestplus/utils.py index 8a6df5c..c0c7064 100644 --- a/pytest_doctestplus/utils.py +++ b/pytest_doctestplus/utils.py @@ -3,6 +3,7 @@ from importlib.metadata import distribution from packaging.requirements import Requirement + class ModuleChecker: def find_module(self, module): From f91f59704b974cc4b91d2542dd1b9798dd49c064 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Wed, 19 Mar 2025 01:30:05 +0100 Subject: [PATCH 05/30] nightly pytests utf8 failes due exception in DebugRunnerPlus --- tests/test_doctestplus.py | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index 63a5572..9ceb9fb 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1538,3 +1538,75 @@ def f(): original_fixed = original.replace("1\n 2", "\n ".join(["0", "1", "2", "3"])) assert result == original_fixed + +@pytest.mark.parametrize('encoding', ['utf-8', 'cp1252']) +def test_file_encoding(testdir, capsys, encoding): + p = testdir.makepyfile(""" + def f(): + ''' + >>> print(2) + 4 + >>> print(3) + 5 + ''' + pass + """) + with open(p) as f: + original = f.read() + + testdir.inline_run(p, "--doctest-plus-generate-diff", "--text-file-encoding", encoding) + diff = dedent(""" + >>> print(2) + - 4 + + 2 + >>> print(3) + - 5 + + 3 + """) + captured = capsys.readouterr() + assert diff in captured.out + + testdir.inline_run(p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding) + captured = capsys.readouterr() + assert "Applied fix to the following files" in captured.out + + with open(p) as f: + result = f.read() + + assert result == original.replace("4", "2").replace("5", "3") + +@pytest.mark.parametrize('encoding', ['utf-8']) +def test_file_encoding_utf8(testdir, capsys, encoding): + p = testdir.makepyfile(""" + def f(): + ''' + >>> print(☆) + ★ + >>> print(☁) + ☀ + ''' + pass + """, encoding=encoding) + with open(p, encoding=encoding) as f: + original = f.read() + + testdir.inline_run(p, "--doctest-plus-generate-diff=diff", "--text-file-encoding", encoding) + diff = dedent(""" + >>> print(☆) + - ★ + + ☆ + >>> print(☁) + - ☀ + + ☁ + """) + captured = capsys.readouterr() + assert diff in captured.out + + testdir.inline_run(p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding) + captured = capsys.readouterr() + assert "Applied fix to the following files" in captured.out + + with open(p, encoding=encoding) as f: + result = f.read() + + assert result == original.replace("★", "☆").replace("☀", "☁") From a15cea02a667468e92e0251d1c4d49f9f6ce717c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Sun, 23 Mar 2025 09:02:08 +0100 Subject: [PATCH 06/30] moved encoding tests to new file --- tests/test_doctestplus.py | 72 ----------------------------- tests/test_encoding.py | 96 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 72 deletions(-) create mode 100644 tests/test_encoding.py diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index 9ceb9fb..63a5572 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1538,75 +1538,3 @@ def f(): original_fixed = original.replace("1\n 2", "\n ".join(["0", "1", "2", "3"])) assert result == original_fixed - -@pytest.mark.parametrize('encoding', ['utf-8', 'cp1252']) -def test_file_encoding(testdir, capsys, encoding): - p = testdir.makepyfile(""" - def f(): - ''' - >>> print(2) - 4 - >>> print(3) - 5 - ''' - pass - """) - with open(p) as f: - original = f.read() - - testdir.inline_run(p, "--doctest-plus-generate-diff", "--text-file-encoding", encoding) - diff = dedent(""" - >>> print(2) - - 4 - + 2 - >>> print(3) - - 5 - + 3 - """) - captured = capsys.readouterr() - assert diff in captured.out - - testdir.inline_run(p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding) - captured = capsys.readouterr() - assert "Applied fix to the following files" in captured.out - - with open(p) as f: - result = f.read() - - assert result == original.replace("4", "2").replace("5", "3") - -@pytest.mark.parametrize('encoding', ['utf-8']) -def test_file_encoding_utf8(testdir, capsys, encoding): - p = testdir.makepyfile(""" - def f(): - ''' - >>> print(☆) - ★ - >>> print(☁) - ☀ - ''' - pass - """, encoding=encoding) - with open(p, encoding=encoding) as f: - original = f.read() - - testdir.inline_run(p, "--doctest-plus-generate-diff=diff", "--text-file-encoding", encoding) - diff = dedent(""" - >>> print(☆) - - ★ - + ☆ - >>> print(☁) - - ☀ - + ☁ - """) - captured = capsys.readouterr() - assert diff in captured.out - - testdir.inline_run(p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding) - captured = capsys.readouterr() - assert "Applied fix to the following files" in captured.out - - with open(p, encoding=encoding) as f: - result = f.read() - - assert result == original.replace("★", "☆").replace("☀", "☁") diff --git a/tests/test_encoding.py b/tests/test_encoding.py new file mode 100644 index 0000000..6eb13bc --- /dev/null +++ b/tests/test_encoding.py @@ -0,0 +1,96 @@ +from textwrap import dedent + +import pytest + +pytest_plugins = ["pytester"] + + +@pytest.mark.parametrize("encoding", ["utf-8", "cp1252"]) +def test_file_encoding(testdir, capsys, encoding): + p = testdir.makepyfile( + """ + def f(): + ''' + >>> print(2) + 4 + >>> print(3) + 5 + ''' + pass + """ + ) + with open(p) as f: + original = f.read() + + testdir.inline_run( + p, "--doctest-plus-generate-diff", "--text-file-encoding", encoding + ) + diff = dedent( + """ + >>> print(2) + - 4 + + 2 + >>> print(3) + - 5 + + 3 + """ + ) + captured = capsys.readouterr() + assert diff in captured.out + + testdir.inline_run( + p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding + ) + captured = capsys.readouterr() + assert "Applied fix to the following files" in captured.out + + with open(p) as f: + result = f.read() + + assert result == original.replace("4", "2").replace("5", "3") + + +@pytest.mark.parametrize("encoding", ["utf-8"]) +def test_file_encoding_utf8(testdir, capsys, encoding): + p = testdir.makepyfile( + """ + def f(): + ''' + >>> print(☆) + ★ + >>> print(☁) + ☀ + ''' + pass + """, + encoding=encoding, + ) + with open(p, encoding=encoding) as f: + original = f.read() + + testdir.inline_run( + p, "--doctest-plus-generate-diff=diff", "--text-file-encoding", encoding + ) + diff = dedent( + """ + >>> print(☆) + - ★ + + ☆ + >>> print(☁) + - ☀ + + ☁ + """ + ) + captured = capsys.readouterr() + assert diff in captured.out + + testdir.inline_run( + p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding + ) + captured = capsys.readouterr() + assert "Applied fix to the following files" in captured.out + + with open(p, encoding=encoding) as f: + result = f.read() + + assert result == original.replace("★", "☆").replace("☀", "☁") From 7940839ed4a3b9cdc56c91756aaed35721c25cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Sun, 23 Mar 2025 12:44:42 +0100 Subject: [PATCH 07/30] bugfix for diffing --- pytest_doctestplus/plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index e091cc1..450142e 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -991,7 +991,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): # exit status: with subprocess.Popen( ["git", "diff", "-p", "--no-index", fname, new_fname], - stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) as p: + stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding=encoding) as p: p.wait() # Diff should be fine, but write error if not: diff = p.stderr.read() From 88eebb59e4122330ff7de6b8b65bacd3c23263ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Sun, 23 Mar 2025 12:49:28 +0100 Subject: [PATCH 08/30] refactor encoding tests to use fixtures and improve readability --- tests/test_encoding.py | 198 ++++++++++++++++++++++++++--------------- 1 file changed, 124 insertions(+), 74 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 6eb13bc..07fe718 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -1,96 +1,146 @@ +import locale +from pathlib import Path from textwrap import dedent +from typing import Callable, Tuple import pytest pytest_plugins = ["pytester"] -@pytest.mark.parametrize("encoding", ["utf-8", "cp1252"]) -def test_file_encoding(testdir, capsys, encoding): - p = testdir.makepyfile( - """ - def f(): - ''' - >>> print(2) - 4 - >>> print(3) - 5 - ''' - pass - """ - ) - with open(p) as f: - original = f.read() +@pytest.fixture( + params=[ + ("A", "a", "utf-8"), + ("☆", "★", "utf-8"), + ("b", "B", "cp1252"), + ("☁", "☀", "utf-8"), + ], + ids=[ + "Aa-utf8", + "star-utf8", + "bB-cp1252", + "cloud-utf8", + ], +) +def charset(request): + return request.param + + +@pytest.fixture() +def basic_file(tmp_path: Path) -> Callable[[str, str, str], Tuple[Path, str, str]]: + + def makebasicfile(a, b, encoding: str) -> Tuple[Path, str, str]: + """alternative implementation without the use of `testdir.makepyfile`.""" + + content = """ + def f(): + ''' + >>> print('{}') + {} + ''' + pass + """ + + original = dedent(content.format(a, b)) + expected_result = dedent(content.format(a, a)) + + original_file = tmp_path.joinpath("test_basic.py") + original_file.write_text(original, encoding=encoding) + + expected_diff = dedent( + f""" + >>> print('{a}') + - {b} + + {a} + """ + ).strip("\n") + + return original_file, expected_diff, expected_result + + return makebasicfile + + +def test_basic_file_encoding_diff(testdir, capsys, basic_file, charset): + """ + Test the diff from console output is as expected. + """ + a, b, encoding = charset + + file, diff, _ = basic_file(a, b, encoding) testdir.inline_run( - p, "--doctest-plus-generate-diff", "--text-file-encoding", encoding + file, "--doctest-plus-generate-diff", "--text-file-encoding", encoding ) - diff = dedent( - """ - >>> print(2) - - 4 - + 2 - >>> print(3) - - 5 - + 3 + + stdout, _ = capsys.readouterr() + assert diff in stdout + + +def test_basic_file_encoding_overwrite(testdir, basic_file, charset): + """ + Test that the file is overwritten with the expected content. """ - ) - captured = capsys.readouterr() - assert diff in captured.out + + a, b, encoding = charset + + file, _, expected = basic_file(a, b, encoding) testdir.inline_run( - p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding - ) - captured = capsys.readouterr() - assert "Applied fix to the following files" in captured.out - - with open(p) as f: - result = f.read() - - assert result == original.replace("4", "2").replace("5", "3") - - -@pytest.mark.parametrize("encoding", ["utf-8"]) -def test_file_encoding_utf8(testdir, capsys, encoding): - p = testdir.makepyfile( - """ - def f(): - ''' - >>> print(☆) - ★ - >>> print(☁) - ☀ - ''' - pass - """, - encoding=encoding, + file, + "--doctest-plus-generate-diff", + "overwrite", + "--text-file-encoding", + encoding, ) - with open(p, encoding=encoding) as f: - original = f.read() + + assert expected in file.read_text(encoding) + + +def test_legacy_diff(testdir, capsys, basic_file, charset): + """ + Legacy test are supported to fail on Windows, when no encoding is provided. + + On Windows this is cp1252, so "utf-8" are expected to fail while writing test files. + """ + a, b, _ = charset + + try: + file, diff, _ = basic_file(a, b, None) + except UnicodeEncodeError: + encoding = locale.getpreferredencoding(False) + reason = f"could not encode {repr(charset)} with {encoding=}" + pytest.xfail(reason=reason) testdir.inline_run( - p, "--doctest-plus-generate-diff=diff", "--text-file-encoding", encoding + file, + "--doctest-plus-generate-diff", ) - diff = dedent( - """ - >>> print(☆) - - ★ - + ☆ - >>> print(☁) - - ☀ - + ☁ + + stdout, _ = capsys.readouterr() + + assert diff in stdout + + +def test_legacy_overwrite(testdir, basic_file, charset): """ - ) - captured = capsys.readouterr() - assert diff in captured.out + Legacy test are supported to fail on Windows, when no encoding is provided. + + On Windows this is cp1252, so "utf-8" are expected to fail while writing test files. + """ + + a, b, _encoding = charset + + try: + file, _, expected = basic_file(a, b, None) + except UnicodeEncodeError: + encoding = locale.getpreferredencoding(False) + reason = f"could not encode {repr(charset)} with {encoding=}" + pytest.xfail(reason=reason) testdir.inline_run( - p, "--doctest-plus-generate-diff=overwrite", "--text-file-encoding", encoding + file, + "--doctest-plus-generate-diff", + "overwrite", ) - captured = capsys.readouterr() - assert "Applied fix to the following files" in captured.out - - with open(p, encoding=encoding) as f: - result = f.read() - assert result == original.replace("★", "☆").replace("☀", "☁") + assert expected in file.read_text(_encoding) From 09979a3b41d6a3998bf1ca733875d48d266413ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Sun, 23 Mar 2025 23:09:49 +0100 Subject: [PATCH 09/30] changed fixture from path to str --- tests/test_encoding.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 07fe718..7682946 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -29,7 +29,7 @@ def charset(request): @pytest.fixture() def basic_file(tmp_path: Path) -> Callable[[str, str, str], Tuple[Path, str, str]]: - def makebasicfile(a, b, encoding: str) -> Tuple[Path, str, str]: + def makebasicfile(a, b, encoding: str) -> Tuple[str, str, str]: """alternative implementation without the use of `testdir.makepyfile`.""" content = """ @@ -55,7 +55,7 @@ def f(): """ ).strip("\n") - return original_file, expected_diff, expected_result + return str(original_file), expected_diff, expected_result return makebasicfile @@ -93,7 +93,7 @@ def test_basic_file_encoding_overwrite(testdir, basic_file, charset): encoding, ) - assert expected in file.read_text(encoding) + assert expected in Path(file).read_text(encoding) def test_legacy_diff(testdir, capsys, basic_file, charset): @@ -143,4 +143,4 @@ def test_legacy_overwrite(testdir, basic_file, charset): "overwrite", ) - assert expected in file.read_text(_encoding) + assert expected in Path(file).read_text(_encoding) From 2b56f2c3fc2b16ef6ea750e39af95d7de484d88d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Tue, 1 Apr 2025 15:58:18 +0200 Subject: [PATCH 10/30] refactor encoding tests to use doctest_encoding with ini-file --- tests/test_encoding.py | 54 +++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 7682946..4527e4a 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -1,7 +1,8 @@ import locale +import os from pathlib import Path from textwrap import dedent -from typing import Callable, Tuple +from typing import Callable, Optional import pytest @@ -27,9 +28,9 @@ def charset(request): @pytest.fixture() -def basic_file(tmp_path: Path) -> Callable[[str, str, str], Tuple[Path, str, str]]: +def basic_file(tmp_path: Path) -> Callable[[str, str, str], tuple[str, str, str]]: - def makebasicfile(a, b, encoding: str) -> Tuple[str, str, str]: + def makebasicfile(a, b, encoding: str) -> tuple[str, str, str]: """alternative implementation without the use of `testdir.makepyfile`.""" content = """ @@ -60,42 +61,78 @@ def f(): return makebasicfile -def test_basic_file_encoding_diff(testdir, capsys, basic_file, charset): +@pytest.fixture() +def ini_file(testdir) -> Callable[..., Path]: + + def makeini( + encoding: Optional[str] = None, + ) -> Path: + """Create a pytest.ini file with the specified encoding.""" + + ini = ["[pytest]"] + + if encoding is not None: + ini.append(f"doctest_encoding = {encoding}") + + ini.append("") + + p = testdir.makefile(".ini", pytest="\n".join(ini)) + + return Path(p) + + return makeini + + +def test_basic_file_encoding_diff(testdir, capsys, basic_file, charset, ini_file): """ Test the diff from console output is as expected. """ a, b, encoding = charset + # create python file to test file, diff, _ = basic_file(a, b, encoding) + # create pytest.ini file + ini = ini_file(encoding=encoding) + assert ini.is_file(), "setup pytest.ini not created/found" + testdir.inline_run( - file, "--doctest-plus-generate-diff", "--text-file-encoding", encoding + file, + "--doctest-plus-generate-diff", + "--config-file", + str(ini), ) stdout, _ = capsys.readouterr() assert diff in stdout -def test_basic_file_encoding_overwrite(testdir, basic_file, charset): +def test_basic_file_encoding_overwrite(testdir, basic_file, charset, ini_file): """ Test that the file is overwritten with the expected content. """ a, b, encoding = charset + # create python file to test file, _, expected = basic_file(a, b, encoding) + # create pytest.ini file + ini = ini_file(encoding=encoding) + assert ini.is_file(), "setup pytest.ini not created/found" + testdir.inline_run( file, "--doctest-plus-generate-diff", "overwrite", - "--text-file-encoding", - encoding, + "--config-file", + str(ini), ) assert expected in Path(file).read_text(encoding) +@pytest.mark.skipif(os.getenv("CI", False), reason="skip on CI") def test_legacy_diff(testdir, capsys, basic_file, charset): """ Legacy test are supported to fail on Windows, when no encoding is provided. @@ -121,6 +158,7 @@ def test_legacy_diff(testdir, capsys, basic_file, charset): assert diff in stdout +@pytest.mark.skipif(os.getenv("CI", False), reason="skip on CI") def test_legacy_overwrite(testdir, basic_file, charset): """ Legacy test are supported to fail on Windows, when no encoding is provided. From 4a639d7e3c84375a5ae8774b33d98be6a64dbcce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Tue, 1 Apr 2025 16:01:52 +0200 Subject: [PATCH 11/30] remove text file encoding options from pytest_addoption --- pytest_doctestplus/plugin.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index 450142e..b94446b 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -112,10 +112,6 @@ def pytest_addoption(parser): "This is no longer recommended, use --doctest-glob instead." )) - parser.addoption("--text-file-encoding", action="store", - help="Specify encoding for files.", - default="utf-8") - # Defaults to `atol` parameter from `numpy.allclose`. parser.addoption("--doctest-plus-atol", action="store", help="set the absolute tolerance for float comparison", @@ -147,9 +143,6 @@ def pytest_addoption(parser): "Default format for docs. " "This is no longer recommended, use --doctest-glob instead.") - parser.addini("text_file_encoding", - "Default encoding for text files.", default=None) - parser.addini("doctest_optionflags", "option flags for doctests", type="args", default=["ELLIPSIS", "NORMALIZE_WHITESPACE"],) @@ -961,8 +954,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config): if not diff_mode: return # we do not report or apply diffs - # get encoding to open file default ini=None or option="utf-8" - encoding = config.getini("text_file_encoding") or config.getoption("text_file_encoding") + encoding = config.getini("doctest_encoding") if diff_mode != "overwrite": # In this mode, we write a corrected file to a temporary folder in From f0ec39e5335e8c1a4457e2000ed87220a445a7e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20D=C3=B6rrer?= Date: Tue, 1 Apr 2025 17:55:55 +0200 Subject: [PATCH 12/30] changed option for pytest.ini to run on pytest < 7.4 --- tests/test_encoding.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 4527e4a..0319e9f 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -99,7 +99,7 @@ def test_basic_file_encoding_diff(testdir, capsys, basic_file, charset, ini_file testdir.inline_run( file, "--doctest-plus-generate-diff", - "--config-file", + "-c", str(ini), ) @@ -125,7 +125,7 @@ def test_basic_file_encoding_overwrite(testdir, basic_file, charset, ini_file): file, "--doctest-plus-generate-diff", "overwrite", - "--config-file", + "-c", str(ini), ) From 096fa3df1e98452ed04683f7feb9a93bc5e4c85c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:28:23 +0000 Subject: [PATCH 13/30] Bump actions/setup-python in /.github/workflows in the actions group Bumps the actions group in /.github/workflows with 1 update: [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/setup-python` from 5.4.0 to 5.5.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/42375524e23c412d93fb67b49958b491fce71c38...8d9ed9ac5c53483de85588cdf95a591a75ab9f55) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 5.5.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- .github/workflows/python-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7a6904c..f5c34f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 with: python-version: '3.10' diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index bab577c..206dd93 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 + uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 with: python-version: ${{ matrix.python-version }} - name: Install Tox From 9e6eef06be90e5c11b8029fc5faab7c606b7cdd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Wed, 16 Apr 2025 10:29:00 -0700 Subject: [PATCH 14/30] MAINT: exclude bots from release notes --- .github/release.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9d1e098 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,5 @@ +changelog: + exclude: + authors: + - dependabot + - pre-commit-ci From 149a8bf29b5d96a2c7787f038b3660fb709eff5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 21 Apr 2025 15:40:54 -0700 Subject: [PATCH 15/30] TST: adding new python version to the fail list --- 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 63a5572..fbe793c 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1210,7 +1210,7 @@ def f(): @pytest.mark.xfail( - python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.12.3'), + python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.11.12', '3.12.3'), reason='broken by https://github.com/python/cpython/pull/115440') def test_ufunc(testdir): pytest.importorskip('numpy') From 5bea80f73e3adcec263cff3ec36108e1250f1231 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 May 2025 16:12:15 +0000 Subject: [PATCH 16/30] Bump actions/setup-python in /.github/workflows in the actions group Bumps the actions group in /.github/workflows with 1 update: [actions/setup-python](https://github.com/actions/setup-python). Updates `actions/setup-python` from 5.5.0 to 5.6.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/8d9ed9ac5c53483de85588cdf95a591a75ab9f55...a26af69be951a213d495a4c3e4e4022e16d87065) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 5.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- .github/workflows/python-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f5c34f2..0464dba 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: fetch-depth: 0 - - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: '3.10' diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 206dd93..5574b50 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0 + uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 with: python-version: ${{ matrix.python-version }} - name: Install Tox From 6b9e5b1bfef7e91500e7964af173fedb2a270631 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 1 May 2025 12:22:07 -0400 Subject: [PATCH 17/30] Fix CI env var def in test_encoding.py --- tests/test_encoding.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_encoding.py b/tests/test_encoding.py index 0319e9f..8215299 100644 --- a/tests/test_encoding.py +++ b/tests/test_encoding.py @@ -7,6 +7,7 @@ import pytest pytest_plugins = ["pytester"] +IS_CI = os.getenv("CI", "false") == "true" @pytest.fixture( @@ -132,7 +133,7 @@ def test_basic_file_encoding_overwrite(testdir, basic_file, charset, ini_file): assert expected in Path(file).read_text(encoding) -@pytest.mark.skipif(os.getenv("CI", False), reason="skip on CI") +@pytest.mark.skipif(IS_CI, reason="skip on CI") def test_legacy_diff(testdir, capsys, basic_file, charset): """ Legacy test are supported to fail on Windows, when no encoding is provided. @@ -158,7 +159,7 @@ def test_legacy_diff(testdir, capsys, basic_file, charset): assert diff in stdout -@pytest.mark.skipif(os.getenv("CI", False), reason="skip on CI") +@pytest.mark.skipif(IS_CI, reason="skip on CI") def test_legacy_overwrite(testdir, basic_file, charset): """ Legacy test are supported to fail on Windows, when no encoding is provided. From ac6feff5c4667581f093d70f55422b6d1bdcdad3 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Thu, 1 May 2025 12:41:59 -0400 Subject: [PATCH 18/30] TST: Use passenv in tox --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index d81ccfe..ade7ec9 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ isolated_build = true [testenv] changedir = .tmp/{envname} +passenv = HOME,WINDIR,LC_ALL,LC_CTYPE,CI setenv = numpydev: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/scientific-python-nightly-wheels/simple description = run tests From cfec47dc8412a487db0ea13ae1899210ce5734db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 27 May 2025 12:31:41 -0700 Subject: [PATCH 19/30] MAINT: xfailing test now passes with new version --- tests/test_doctestplus.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index fbe793c..406997e 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -13,10 +13,12 @@ try: import pytest_asyncio # noqa: F401 - has_pytest_asyncio = True + if Version(pytest_asyncio.__version__) < Version('1.0'): + main_pytest_asyncio_xfails = True + else: + main_pytest_asyncio_xfails = False except ImportError: - has_pytest_asyncio = False - + main_pytest_asyncio_xfails = False pytest_plugins = ['pytester'] @@ -1189,7 +1191,7 @@ class MyClass: @pytest.mark.xfail( - has_pytest_asyncio, + main_pytest_asyncio_xfails, reason='pytest_asyncio monkey-patches .collect()') def test_main(testdir): pkg = testdir.mkdir('pkg') From b28e4adbf061b113fa857fe4d8cfee808b8f0b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 27 May 2025 13:08:41 -0700 Subject: [PATCH 20/30] CI: adding deprecation filterwarning for pytest-asyncio --- setup.cfg | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.cfg b/setup.cfg index 4d95b5b..b15c6c6 100644 --- a/setup.cfg +++ b/setup.cfg @@ -58,6 +58,9 @@ filterwarnings = error ignore:file format.*:UserWarning ignore:.*non-empty pattern match.*:FutureWarning + # For pytest-asyncio deprecations that is expected to be resolved upstream + # https://github.com/pytest-dev/pytest-asyncio/issues/924 + ignore:The configuration option "asyncio_default_fixture_loop_scope":pytest.PytestDeprecationWarning [flake8] max-line-length = 100 From b27a25cd3c6d2390ff1fcc099236f0239fb4db44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 16 Jun 2025 21:24:19 -0700 Subject: [PATCH 21/30] TST: new python version out, new xfail for the test --- 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 406997e..57caf60 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1212,7 +1212,7 @@ def f(): @pytest.mark.xfail( - python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.11.12', '3.12.3'), + python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.11.12', '3.11.13', '3.12.3'), reason='broken by https://github.com/python/cpython/pull/115440') def test_ufunc(testdir): pytest.importorskip('numpy') From 530bdd8898e7c497b657c20bde7eec0316ecdc7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 18 Aug 2025 18:05:55 -0700 Subject: [PATCH 22/30] CI: adding Python 3.14 for testing --- .github/workflows/python-tests.yml | 12 ++++++------ tox.ini | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 5574b50..463457e 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -62,14 +62,14 @@ jobs: python-version: '3.13' toxenv: py313-test-pytest83 - os: windows-latest - python-version: '3.13' - toxenv: py313-test-pytestdev + python-version: '3.14-dev' + toxenv: py314-test-pytestdev - os: macos-latest - python-version: '3.12' - toxenv: py312-test-pytestdev + python-version: '3.14-dev' + toxenv: py314-test-pytestdev - os: ubuntu-latest - python-version: '3.13' - toxenv: py313-test-pytestdev-numpydev + python-version: '3.14-dev' + toxenv: py314-test-pytestdev-numpydev - os: ubuntu-latest python-version: '3.13' toxenv: py313-test-pytest83-pytestasyncio diff --git a/tox.ini b/tox.ini index ade7ec9..8133d8b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{39,310,311,312,313}-test + py{39,310,311,312,313,314}-test codestyle requires = setuptools >= 30.3.0 From 7a3de3c70abc40fc70cd24485edbc03ec36fa5cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Mon, 18 Aug 2025 23:57:07 -0700 Subject: [PATCH 23/30] TST: ignore unclosed file for failing test --- tests/test_doctestplus.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_doctestplus.py b/tests/test_doctestplus.py index 57caf60..1cff957 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -769,6 +769,8 @@ def f(): ).assertoutcome(passed=2) +# We see unclosed file ResourceWarning on windows with python 3.14 +@pytest.mark.filterwarnings('ignore:unclosed file:ResourceWarning') def test_doctest_only(testdir, makepyfile, maketestfile, makerstfile): # regular python files with doctests makepyfile(p1='>>> 1 + 1\n2') From 54ee971e3262bb6a5dd7649c37b3cbada5a69920 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 05:27:36 +0000 Subject: [PATCH 24/30] Bump actions/checkout in /.github/workflows in the actions group Bumps the actions group in /.github/workflows with 1 update: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 4.2.2 to 5.0.0 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/11bd71901bbe5b1630ceea73d27597364c9af683...08c6903cd8c0fde910a37f88322edcfb5dd907a8) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 2 +- .github/workflows/python-tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0464dba..f99b067 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 463457e..f8b31ea 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -75,7 +75,7 @@ jobs: toxenv: py313-test-pytest83-pytestasyncio steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} From b1957849f56118381fc671384dfa754a9960e847 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Oct 2025 16:16:39 +0000 Subject: [PATCH 25/30] Bump the actions group in /.github/workflows with 2 updates Bumps the actions group in /.github/workflows with 2 updates: [actions/setup-python](https://github.com/actions/setup-python) and [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish). Updates `actions/setup-python` from 5.6.0 to 6.0.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/a26af69be951a213d495a4c3e4e4022e16d87065...e797f83bcb11b83ae66e0230d6156d7c80228e7c) Updates `pypa/gh-action-pypi-publish` from 1.12.4 to 1.13.0 - [Release notes](https://github.com/pypa/gh-action-pypi-publish/releases) - [Commits](https://github.com/pypa/gh-action-pypi-publish/compare/76f52bc884231f62b9a034ebfe128415bbaabdfc...ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pypa/gh-action-pypi-publish dependency-version: 1.13.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions ... Signed-off-by: dependabot[bot] --- .github/workflows/publish.yml | 4 ++-- .github/workflows/python-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f99b067..a7836f2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: fetch-depth: 0 - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + - uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version: '3.10' @@ -46,7 +46,7 @@ jobs: - name: Publish distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4 + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index f8b31ea..d68dbc3 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -79,7 +79,7 @@ jobs: with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 + uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 with: python-version: ${{ matrix.python-version }} - name: Install Tox From b136e5d751c9939a45153a775269b2bc8c3d0a3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 17 Oct 2025 18:24:04 -0700 Subject: [PATCH 26/30] CI: adding pytest 8.4 to the test matrix --- .github/workflows/python-tests.yml | 3 +++ tox.ini | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index d68dbc3..eaa7679 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -61,6 +61,9 @@ jobs: - os: macos-latest python-version: '3.13' toxenv: py313-test-pytest83 + - os: windows-latest + python-version: '3.13' + toxenv: py313-test-pytest84 - os: windows-latest python-version: '3.14-dev' toxenv: py314-test-pytestdev diff --git a/tox.ini b/tox.ini index 8133d8b..54c4644 100644 --- a/tox.ini +++ b/tox.ini @@ -31,6 +31,7 @@ deps = pytest81: pytest==8.1.* pytest82: pytest==8.2.* pytest83: pytest==8.3.* + pytest84: pytest==8.4.* pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest numpydev: numpy>=0.0.dev0 pytestasyncio: pytest-asyncio From 868a64e429aea9e59070b66375ea59d85fec19a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 17 Oct 2025 18:24:39 -0700 Subject: [PATCH 27/30] CI: python 3.14 is released --- .github/workflows/python-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index eaa7679..492fa1c 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -65,13 +65,13 @@ jobs: python-version: '3.13' toxenv: py313-test-pytest84 - os: windows-latest - python-version: '3.14-dev' + python-version: '3.14' toxenv: py314-test-pytestdev - os: macos-latest - python-version: '3.14-dev' + python-version: '3.14' toxenv: py314-test-pytestdev - os: ubuntu-latest - python-version: '3.14-dev' + python-version: '3.14' toxenv: py314-test-pytestdev-numpydev - os: ubuntu-latest python-version: '3.13' From 54a7898b3a1903c4689e6b85f0f87b26f266f8d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 17 Oct 2025 18:32:31 -0700 Subject: [PATCH 28/30] TST: new xfail for new python version --- 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 1cff957..c88aa9f 100644 --- a/tests/test_doctestplus.py +++ b/tests/test_doctestplus.py @@ -1214,7 +1214,7 @@ def f(): @pytest.mark.xfail( - python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.11.12', '3.11.13', '3.12.3'), + python_version() in ('3.11.9', '3.11.10', '3.11.11', '3.11.12', '3.11.13', '3.11.14', '3.12.3'), reason='broken by https://github.com/python/cpython/pull/115440') def test_ufunc(testdir): pytest.importorskip('numpy') From c33bd06b1968d897c5824e140cdfad89529713db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 17 Oct 2025 18:48:11 -0700 Subject: [PATCH 29/30] MAINT: more bots to ignore --- .github/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/release.yml b/.github/release.yml index 9d1e098..e6d02b5 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -2,4 +2,6 @@ changelog: exclude: authors: - dependabot + - dependabot[bot] - pre-commit-ci + - pre-commit-ci[bot] From c6d12560783f1373c0143fa440a3f56f28bf60f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 17 Oct 2025 18:58:43 -0700 Subject: [PATCH 30/30] Finalizing changelog for v1.5.0 --- CHANGES.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index c972289..ea825de 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,8 @@ -1.5.0 (unreleased) +1.5.0 (2025-10-17) ================== - +- Adding the usage of the ``doctest_encoding`` ini option when overwriting + files with the ``doctest-plus-generate-diff`` option. [#284] 1.4.0 (2025-01-24) ==================