diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index fa7844c..5cc48f2 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -68,20 +68,20 @@ jobs: python-version: '3.12' toxenv: py312-test-pytest82 - os: macos-latest - python-version: '3.12' - toxenv: py312-test-pytest82 + python-version: '3.13-dev' + toxenv: py312-test-pytest83 - os: windows-latest - python-version: '3.12' - toxenv: py312-test-pytest82 + python-version: '3.13-dev' + toxenv: py312-test-pytestdev - os: macos-latest python-version: '3.11' toxenv: py311-test-pytestdev - - os: windows-latest - python-version: '3.11' - toxenv: py311-test-pytestdev - os: ubuntu-latest python-version: '3.12' toxenv: py312-test-pytestdev-numpydev + - os: ubuntu-latest + python-version: '3.13-dev' + toxenv: py313-test-pytestdev steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/CHANGES.rst b/CHANGES.rst index 5c64b01..30a03a6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -2,6 +2,7 @@ ================== - Fixing output update for multiline code. [#253] +- Fixing Python 3.13 compatibility. [#260] - Dropped ``setuptools`` as a runtime dependency. [#258] 1.2.1 (2024-03-09) diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py index f9c3a0c..5538c53 100644 --- a/pytest_doctestplus/plugin.py +++ b/pytest_doctestplus/plugin.py @@ -900,7 +900,8 @@ def write_modified_file(fname, new_fname, changes): lineno = change["test_lineno"] + change["example_lineno"] lineno += change["source"].count("\n") - indentation = " " * change["nindent"] + indentation = len(text[lineno-1]) - len(text[lineno-1].lstrip()) + indentation = text[lineno-1][:indentation] want = indent(change["want"], indentation, lambda x: True) # Replace fully blank lines with the required `` # (May need to do this also if line contains only whitespace) diff --git a/tox.ini b/tox.ini index f632ccd..3661c92 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{38,39,310,311,312}-test + py{38,39,310,311,312,313}-test codestyle requires = setuptools >= 30.3.0 @@ -29,6 +29,7 @@ deps = pytest80: pytest==8.0.* pytest81: pytest==8.1.* pytest82: pytest==8.2.* + pytest83: pytest==8.3.* pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest numpydev: numpy>=0.0.dev0