Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pytest-sphinx for
openSUSE:Factory checked in at 2026-03-27 16:50:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-sphinx (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-sphinx.new.8177 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-sphinx"
Fri Mar 27 16:50:41 2026 rev:10 rq:1343087 version:0.7.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-sphinx/python-pytest-sphinx.changes
2024-12-12 21:18:52.190413190 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-sphinx.new.8177/python-pytest-sphinx.changes
2026-03-27 16:53:14.424824215 +0100
@@ -1,0 +2,8 @@
+Fri Mar 27 04:02:31 UTC 2026 - Steve Kowalik <[email protected]>
+
+- Update to 0.7.1:
+ * Drop support for python 3.8 and 3.9 and add support for 3.13 and 3.14
+ * Adapt to changes in doctest stdlib package
+- Drop patch support-python-313.patch, fixed upstream.
+
+-------------------------------------------------------------------
Old:
----
pytest-sphinx-0.6.3.tar.gz
support-python-313.patch
New:
----
_scmsync.obsinfo
build.specials.obscpio
pytest-sphinx-0.7.1.tar.gz
----------(Old B)----------
Old: * Adapt to changes in doctest stdlib package
- Drop patch support-python-313.patch, fixed upstream.
----------(Old E)----------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-sphinx.spec ++++++
--- /var/tmp/diff_new_pack.C6dsH7/_old 2026-03-27 16:53:15.004848496 +0100
+++ /var/tmp/diff_new_pack.C6dsH7/_new 2026-03-27 16:53:15.004848496 +0100
@@ -18,14 +18,13 @@
%{?sle15_python_module_pythons}
Name: python-pytest-sphinx
-Version: 0.6.3
+Version: 0.7.1
Release: 0
Summary: Doctest plugin for pytest with support for Sphinx-specific
doctest-directives
License: BSD-3-Clause
URL: https://github.com/thisch/pytest-sphinx
Source:
https://github.com/thisch/pytest-sphinx/archive/v%{version}.tar.gz#/pytest-sphinx-%{version}.tar.gz
-Patch0: support-python-313.patch
-BuildRequires: %{python_module base >= 3.8}
+BuildRequires: %{python_module base >= 3.10}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
++++++ _scmsync.obsinfo ++++++
mtime: 1774584159
commit: 57b8f5f0bb82a0f59226de08f091f3e88a1d6df757b8b008874bf5ca1bffdfdf
url: https://src.opensuse.org/python-pytest/python-pytest-sphinx.git
revision: 57b8f5f0bb82a0f59226de08f091f3e88a1d6df757b8b008874bf5ca1bffdfdf
projectscmsync: https://src.opensuse.org/python-pytest/_ObsPrj.git
++++++ build.specials.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/.gitignore new/.gitignore
--- old/.gitignore 1970-01-01 01:00:00.000000000 +0100
+++ new/.gitignore 2026-03-27 05:13:08.000000000 +0100
@@ -0,0 +1 @@
+.osc
++++++ pytest-sphinx-0.6.3.tar.gz -> pytest-sphinx-0.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/.flake8
new/pytest-sphinx-0.7.1/.flake8
--- old/pytest-sphinx-0.6.3/.flake8 2024-04-13 21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/.flake8 1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-[flake8]
-max-line-length = 88
-ignore = E203, E501, W503
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-sphinx-0.6.3/.github/workflows/publish-to-pypi.yml
new/pytest-sphinx-0.7.1/.github/workflows/publish-to-pypi.yml
--- old/pytest-sphinx-0.6.3/.github/workflows/publish-to-pypi.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-sphinx-0.7.1/.github/workflows/publish-to-pypi.yml
2026-01-21 19:58:57.000000000 +0100
@@ -0,0 +1,76 @@
+name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
+
+on: push
+
+jobs:
+ build:
+ name: Build distribution 📦
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+ - name: Set up Python
+ uses: actions/setup-python@v6
+ with:
+ python-version: "3.x"
+ - name: Install pypa/build
+ run: >-
+ python3 -m
+ pip install
+ build
+ --user
+ - name: Build a binary wheel and a source tarball
+ run: python3 -m build
+ - name: Store the distribution packages
+ uses: actions/upload-artifact@v5
+ with:
+ name: python-package-distributions
+ path: dist/
+
+ publish-to-pypi:
+ name: >-
+ Publish Python 🐍 distribution 📦 to PyPI
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag
pushes
+ needs:
+ - build
+ runs-on: ubuntu-latest
+ environment:
+ name: pypi
+ url: https://pypi.org/p/pytest-sphinx
+ permissions:
+ id-token: write # IMPORTANT: mandatory for trusted publishing
+
+ steps:
+ - name: Download all the dists
+ uses: actions/download-artifact@v6
+ with:
+ name: python-package-distributions
+ path: dist/
+ - name: Publish distribution 📦 to PyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+
+ publish-to-testpypi:
+ name: Publish Python 🐍 distribution 📦 to TestPyPI
+ needs:
+ - build
+ runs-on: ubuntu-latest
+
+ environment:
+ name: testpypi
+ url: https://test.pypi.org/p/pytest-sphinx
+
+ permissions:
+ id-token: write # IMPORTANT: mandatory for trusted publishing
+
+ steps:
+ - name: Download all the dists
+ uses: actions/download-artifact@v6
+ with:
+ name: python-package-distributions
+ path: dist/
+ - name: Publish distribution 📦 to TestPyPI
+ uses: pypa/gh-action-pypi-publish@release/v1
+ with:
+ repository-url: https://test.pypi.org/legacy/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-sphinx-0.6.3/.github/workflows/pypi-upload.yml
new/pytest-sphinx-0.7.1/.github/workflows/pypi-upload.yml
--- old/pytest-sphinx-0.6.3/.github/workflows/pypi-upload.yml 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/.github/workflows/pypi-upload.yml 1970-01-01
01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-name: pypi_upload
-
-on:
- release:
- types: [published]
-
-jobs:
- build:
- name: PyPI Upload
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v4
-
- - name: Set up Python
- uses: actions/setup-python@v5
- with:
- cache: 'pip'
- cache-dependency-path: 'pyproject.toml'
-
- - name: Install latest pip, build, twine
- run: |
- python -m pip install --upgrade --disable-pip-version-check pip
- python -m pip install --upgrade build twine
- - name: Build wheel and source distributions
- run: |
- python -m build
- - name: Upload to PyPI via Twine
- env:
- TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- run: |
- twine upload --verbose -u '__token__' dist/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/.github/workflows/test.yml
new/pytest-sphinx-0.7.1/.github/workflows/test.yml
--- old/pytest-sphinx-0.6.3/.github/workflows/test.yml 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/.github/workflows/test.yml 2026-01-21
19:58:57.000000000 +0100
@@ -22,7 +22,7 @@
strategy:
fail-fast: false
matrix:
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
+ python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
@@ -41,17 +41,11 @@
python -m pip install --upgrade pip
python -m pip install --upgrade tox
- - name: Lint (flake8)
- run: flake8
+ - name: Ruff format
+ run: ruff format .
- - name: Lint (black)
- run: black --check .
-
- - name: Lint (isort)
- run: isort --check .
-
- # - name: Lint (mypy)
- # run: mypy .
+ - name: Ruff format
+ run: ruff check .
- name: Unit tests
run: |
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/.pre-commit-config.yaml
new/pytest-sphinx-0.7.1/.pre-commit-config.yaml
--- old/pytest-sphinx-0.6.3/.pre-commit-config.yaml 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/.pre-commit-config.yaml 2026-01-21
19:58:57.000000000 +0100
@@ -1,16 +1,10 @@
-# See https://pre-commit.com for more information
-# See https://pre-commit.com/hooks.html for more hooks
repos:
- - repo: https://github.com/psf/black
- rev: 24.3.0
- hooks:
- - id: black
- # nice but doesn't support sphinx syntax - see
https://github.com/Lucas-C/pre-commit-hooks-markup/issues/13
- # - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
- # rev: v1.0.1
- # hooks:
- # - id: rst-linter
- - repo: https://github.com/pycqa/isort
- rev: 5.13.2
- hooks:
- - id: isort
+- repo: https://github.com/astral-sh/ruff-pre-commit
+ # Ruff version.
+ rev: v0.14.7
+ hooks:
+ # Run the linter.
+ - id: ruff-check
+ args: [ --fix ]
+ # Run the formatter.
+ - id: ruff-format
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/CHANGELOG.md
new/pytest-sphinx-0.7.1/CHANGELOG.md
--- old/pytest-sphinx-0.6.3/CHANGELOG.md 2024-04-13 21:08:58.000000000
+0200
+++ new/pytest-sphinx-0.7.1/CHANGELOG.md 2026-01-21 19:58:57.000000000
+0100
@@ -7,6 +7,15 @@
## [Unreleased]
###
+## [0.7.1] - 2026-01-21
+###
+ - Fixed pypi upload issue
+
+## [0.7] - 2025-11-28
+###
+ - Drop support for python 3.8 and 3.9 and add support for 3.13 and 3.14
+ - Adapt to changes in doctest stdlib package (Fixes #67)
+
## [0.6.3] - 2024-04-13
###
- Forgot to bump minimum required pytest version in pytest-sphinx 0.6.2 #64
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/pyproject.toml
new/pytest-sphinx-0.7.1/pyproject.toml
--- old/pytest-sphinx-0.6.3/pyproject.toml 2024-04-13 21:08:58.000000000
+0200
+++ new/pytest-sphinx-0.7.1/pyproject.toml 2026-01-21 19:58:57.000000000
+0100
@@ -1,9 +1,9 @@
[project]
name = "pytest-sphinx"
-version = "0.6.3"
+version = "0.7.1"
description = "Doctest plugin for pytest with support for Sphinx-specific
doctest-directives"
readme = "README.rst"
-requires-python = ">=3.8"
+requires-python = ">=3.10"
license = { file = "LICENSE" }
keywords = ["sphinx", "pytest", "rst"]
authors = [
@@ -20,11 +20,12 @@
"Topic :: Software Development :: Testing",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
"Programming Language :: Python :: Implementation :: CPython",
"Operating System :: OS Independent",
"License :: OSI Approved :: BSD License",
@@ -37,10 +38,7 @@
[project.optional-dependencies]
lint = [
- "isort >= 5",
- "flake8",
- "black",
- "mypy"
+ "ruff",
]
[project.urls]
@@ -49,13 +47,91 @@
[project.entry-points."pytest11"]
"sphinx" = "pytest_sphinx"
-[tool.isort]
-profile = "black"
-
-[tool.mypy]
-strict = true
-warn_unused_ignores = false # mypy#8823
-
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
+
+[dependency-groups]
+dev = [
+ "sphinx>=8.1.3",
+]
+
+
+[tool.ruff]
+# Exclude a variety of commonly ignored directories.
+exclude = [
+ ".bzr",
+ ".direnv",
+ ".eggs",
+ ".git",
+ ".git-rewrite",
+ ".hg",
+ ".ipynb_checkpoints",
+ ".mypy_cache",
+ ".nox",
+ ".pants.d",
+ ".pyenv",
+ ".pytest_cache",
+ ".pytype",
+ ".ruff_cache",
+ ".svn",
+ ".tox",
+ ".venv",
+ ".vscode",
+ "__pypackages__",
+ "_build",
+ "buck-out",
+ "build",
+ "dist",
+ "node_modules",
+ "site-packages",
+ "venv",
+]
+
+# Same as Black.
+line-length = 88
+indent-width = 4
+
+target-version = "py310"
+
+
+[tool.ruff.lint]
+select = ["E", # pycodestyle
+ "F", # pyflakes
+ "PL", # pylint
+ "UP", # refurb
+ "R", # pylint-related
+ "D", # docstring
+ "PT", # pytest
+ "B", # bugbear
+ "D212", # summary of multi-line docstrings should start at first line
+ "D417", # undocumented-param
+ "I", # isort
+]
+ignore = [
+ "PLR2004", # magic value used in comparison
+ "PLR0911", # too many return statements
+ "PLR0912", # too many branches
+ "PLR0915", # too many statements
+ "D100", # missing docstring in public module
+ "D101", # missing docstring in public class
+ "D102", # missing docstring in public method
+ "D103", # missing docstring in public function
+ "D104", # missing docstring in public package
+ "D105", # missing docstring in magic method
+ "D107", # missing docstring in __init__
+ "D401", # imperative mood
+]
+
+[tool.ruff.lint.pydocstyle]
+convention = "numpy"
+
+[tool.ruff.lint.isort]
+force-single-line = true
+
+[tool.pytest.ini_options]
+minversion = "6.0"
+addopts = "-ra -q"
+testpaths = [
+ "tests",
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/setup.cfg
new/pytest-sphinx-0.7.1/setup.cfg
--- old/pytest-sphinx-0.6.3/setup.cfg 2024-04-13 21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/setup.cfg 1970-01-01 01:00:00.000000000 +0100
@@ -1,4 +0,0 @@
-[flake8]
-exclude = .*/,.tox,*.egg
-max-line-length = 88
-extend-ignore = E203
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/src/pytest_sphinx.py
new/pytest-sphinx-0.7.1/src/pytest_sphinx.py
--- old/pytest-sphinx-0.6.3/src/pytest_sphinx.py 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/src/pytest_sphinx.py 2026-01-21
19:58:57.000000000 +0100
@@ -1,33 +1,29 @@
-"""
+"""Sphinx pytest plugin.
+
http://www.sphinx-doc.org/en/stable/ext/doctest.html
-https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/doctest.py
+https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/doctest.py.
* TODO
** CLEANUP: use the sphinx directive parser from the sphinx project
"""
+from __future__ import annotations
+
import doctest
import enum
import re
import sys
import textwrap
import traceback
+from collections.abc import Iterator
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any
-from typing import Dict
-from typing import Iterator
-from typing import List
-from typing import Optional
-from typing import Tuple
-from typing import Union
import _pytest.doctest
import pytest
from _pytest.config import Config
from _pytest.doctest import DoctestItem
-from _pytest.doctest import _is_mocked
-from _pytest.doctest import _patch_unwrap_mock_aware
from _pytest.main import Session
from _pytest.pathlib import import_path
from _pytest.python import Package
@@ -62,12 +58,12 @@
def pytest_collect_file(
- file_path: Path, parent: Union[Session, Package]
-) -> Optional[Union["SphinxDoctestModule", "SphinxDoctestTextfile"]]:
+ file_path: Path, parent: Session | Package
+) -> SphinxDoctestModule | SphinxDoctestTextfile | None:
config = parent.config
if file_path.suffix == ".py":
if config.option.doctestmodules:
- mod: Union["SphinxDoctestModule", "SphinxDoctestTextfile"] = (
+ mod: SphinxDoctestModule | SphinxDoctestTextfile = (
SphinxDoctestModule.from_parent(parent, path=file_path)
)
return mod
@@ -76,10 +72,10 @@
return None
-GlobDict = Dict[str, Any]
+GlobDict = dict[str, Any]
-def _is_doctest(config: Config, path: Path, parent: Union[Session, Package])
-> bool:
+def _is_doctest(config: Config, path: Path, parent: Session | Package) -> bool:
if path.suffix in (".txt", ".rst") and parent.session.isinitpath(path):
return True
globs = config.getoption("doctestglob") or ["test*.txt"]
@@ -110,7 +106,7 @@
def _split_into_body_and_options(
section_content: str,
-) -> Tuple[str, Optional[str], Dict[int, bool]]:
+) -> tuple[str, str | None, dict[int, bool]]:
"""Parse the the full content of a directive and split it.
It is split into a string, where the options (:options:, :hide: and
@@ -186,8 +182,8 @@
def _get_next_textoutputsections(
- sections: List["Section"], index: int
-) -> Iterator["Section"]:
+ sections: list[Section], index: int
+) -> Iterator[Section]:
"""Yield successive TESTOUTPUT sections."""
for j in range(index, len(sections)):
section = sections[j]
@@ -197,7 +193,7 @@
break
-SectionGroups = Optional[List[str]]
+SectionGroups = list[str] | None
class Section:
@@ -223,7 +219,7 @@
self.options = options
-def get_sections(docstring: str) -> List[Union[Any, Section]]:
+def get_sections(docstring: str) -> list[Any | Section]:
lines = textwrap.dedent(docstring).splitlines()
sections = []
@@ -273,11 +269,11 @@
def docstring2examples(
- docstring: str, globs: Optional[GlobDict] = None
-) -> List[Union[Any, doctest.Example]]:
- """
- Parse all sphinx test directives in the docstring and create a
- list of examples.
+ docstring: str, globs: GlobDict | None = None
+) -> list[Any | doctest.Example]:
+ """Parse all sphinx test directives in the docstring.
+
+ This function also creates a list of examples that are returned.
"""
# TODO subclass doctest.DocTestParser instead?
@@ -287,11 +283,11 @@
sections = get_sections(docstring)
def get_testoutput_section_data(
- section: "Section",
- ) -> Tuple[str, Dict[int, bool], int, Optional[Any]]:
+ section: Section,
+ ) -> tuple[str, dict[int, bool], int, Any | None]:
want = section.body
exc_msg = None
- options: Dict[int, bool] = {}
+ options: dict[int, bool] = {}
if section.skipif_expr and eval(section.skipif_expr, globs):
want = ""
@@ -346,20 +342,19 @@
class SphinxDocTestRunner(doctest.DebugRunner):
- """
- overwrite doctest.DocTestRunner.__run, since it uses 'single' for the
- `compile` function instead of 'exec'.
+ """Overwrite `doctest.DocTestRunner.__run`.
+
+ since it uses 'single' for the `compile` function instead of 'exec'.
"""
- _checker: "doctest.OutputChecker"
- _fakeout: "_SpoofOut"
- debugger: "pdb.Pdb"
+ _checker: doctest.OutputChecker
+ _fakeout: _SpoofOut
+ debugger: pdb.Pdb
def _DocTestRunner__run(
- self, test: doctest.DocTest, compileflags: int, out: "_Out"
+ self, test: doctest.DocTest, compileflags: int, out: _Out
) -> doctest.TestResults:
- """
- Run the examples in `test`.
+ """Run the examples in `test`.
Write the outcome of each example with one of the
`DocTestRunner.report_*` methods, using the writer function
@@ -371,7 +366,7 @@
"""
# Keep track of the number of failures and tries.
- failures = tries = 0
+ failures = tries = skips = 0
# Save the option flags (since option directives can be used
# to modify them).
@@ -383,7 +378,6 @@
# Process each example.
for examplenum, example in enumerate(test.examples):
-
# If REPORT_ONLY_FIRST_FAILURE is set, then suppress
# reporting after the first failure.
quiet = (
@@ -401,6 +395,7 @@
# If 'SKIP' is set, then skip this example.
if self.optionflags & doctest.SKIP:
+ skips += 1
continue
# Record that we started this example.
@@ -411,7 +406,7 @@
# Use a special filename for compile(), so we can retrieve
# the source code during interactive debugging (see
# __patched_linecache_getlines).
- filename = "<doctest %s[%d]>" % (test.name, examplenum)
+ filename = f"<doctest {test.name}[{examplenum}]>"
# Run the example in the given context (globs), and record
# any exception that gets raised. (But don't intercept
@@ -486,7 +481,7 @@
)
failures += 1
else:
- assert False, ("unknown outcome", outcome)
+ raise AssertionError(("unknown outcome", outcome))
if failures and self.optionflags & doctest.FAIL_FAST:
break
@@ -495,7 +490,10 @@
self.optionflags = original_optionflags
# Record and return the number of failures and tries.
- self._DocTestRunner__record_outcome(test, failures, tries) #
type:ignore
+ if sys.version_info >= (3, 13):
+ self._DocTestRunner__record_outcome(test, failures, tries, skips)
# type:ignore
+ else:
+ self._DocTestRunner__record_outcome(test, failures, tries) #
type:ignore
return doctest.TestResults(failures, tries)
@@ -503,7 +501,7 @@
def get_doctest(
self,
docstring: str,
- globs: Dict[str, Any],
+ globs: dict[str, Any],
name: str,
filename: str,
lineno: int,
@@ -562,52 +560,12 @@
)
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
- pytest.skip("unable to import module %r" % self.path)
+ pytest.skip(f"unable to import module {self.path!r}")
else:
raise
optionflags = _pytest.doctest.get_optionflags(self.config) #
type:ignore
- class MockAwareDocTestFinder(doctest.DocTestFinder):
- """
- a hackish doctest finder that overrides stdlib internals to fix
- a stdlib bug
- https://github.com/pytest-dev/pytest/issues/3456
- https://bugs.python.org/issue25532
-
- fix taken from https://github.com/pytest-dev/pytest/pull/4212/
- """
-
- def _find(
- self,
- tests: List[doctest.DocTest],
- obj: str,
- name: str,
- module: Any,
- source_lines: Optional[List[str]],
- globs: GlobDict,
- seen: Dict[int, int],
- ) -> None:
- if _is_mocked(obj):
- return
- with _patch_unwrap_mock_aware():
- doctest.DocTestFinder._find( # type:ignore
- self,
- tests,
- obj,
- name,
- module,
- source_lines,
- globs,
- seen,
- )
-
- if sys.version_info < (3, 10):
- finder = MockAwareDocTestFinder(
- parser=SphinxDocTestParser() # type:ignore
- )
- else:
- finder = doctest.DocTestFinder(parser=SphinxDocTestParser()) #
type:ignore
-
+ finder = doctest.DocTestFinder(parser=SphinxDocTestParser()) #
type:ignore
runner = SphinxDocTestRunner(
verbose=False,
optionflags=optionflags,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/tests/test_doc2test.py
new/pytest-sphinx-0.7.1/tests/test_doc2test.py
--- old/pytest-sphinx-0.6.3/tests/test_doc2test.py 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/tests/test_doc2test.py 2026-01-21
19:58:57.000000000 +0100
@@ -10,19 +10,17 @@
@pytest.mark.parametrize("in_between_content", ["", "\nsome text\nmore text"])
def test_simple(in_between_content: str) -> None:
- doc = """
+ doc = f"""
.. testcode::
import pprint
pprint.pprint({{'3': 4, '5': 6}})
-{}
+{in_between_content}
.. testoutput::
{{'3': 4,
'5': 6}}
-""".format(
- in_between_content
- )
+"""
examples = docstring2examples(doc)
assert len(examples) == 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/tests/test_options.py
new/pytest-sphinx-0.7.1/tests/test_options.py
--- old/pytest-sphinx-0.6.3/tests/test_options.py 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/tests/test_options.py 2026-01-21
19:58:57.000000000 +0100
@@ -87,14 +87,12 @@
@pytest.mark.parametrize("with_options", [True, False])
def test_skipif_and_text(expr: str, with_options: bool) -> None:
want = textwrap.dedent(
- """
- :skipif: {}
+ f"""
+ :skipif: {expr}
abcedf
abcedf
- """.format(
- expr
- )
+ """
)
if with_options:
want = "\n:options: +NORMALIZE_WHITESPACE" + want
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/tests/test_python_files.py
new/pytest-sphinx-0.7.1/tests/test_python_files.py
--- old/pytest-sphinx-0.6.3/tests/test_python_files.py 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/tests/test_python_files.py 2026-01-21
19:58:57.000000000 +0100
@@ -4,7 +4,6 @@
def test_syntax_error_in_module_doctest(testdir: Testdir) -> None:
-
testdir.makepyfile(
textwrap.dedent(
"""
@@ -28,7 +27,6 @@
def test_failing_module_doctest(testdir: Testdir) -> None:
-
testdir.makepyfile(
textwrap.dedent(
"""
@@ -82,7 +80,6 @@
def test_working_module_doctest(testdir: Testdir) -> None:
-
testdir.makepyfile(
textwrap.dedent(
"""
@@ -129,7 +126,6 @@
def test_working_module_doctest_nospaces(testdir: Testdir) -> None:
-
testdir.makepyfile(
textwrap.dedent(
"""
@@ -149,7 +145,6 @@
def test_multiple_doctests_in_single_file(testdir: Testdir) -> None:
-
testdir.makepyfile(
textwrap.dedent(
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/tests/test_sphinx_doctest.py
new/pytest-sphinx-0.7.1/tests/test_sphinx_doctest.py
--- old/pytest-sphinx-0.6.3/tests/test_sphinx_doctest.py 2024-04-13
21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/tests/test_sphinx_doctest.py 2026-01-21
19:58:57.000000000 +0100
@@ -1,12 +1,12 @@
-""" Run tests that call "sphinx-build -M doctest". """
+"""Run tests that call "sphinx-build -M doctest"."""
import logging
import os
import subprocess
+import sys
import textwrap
+from collections.abc import Iterator
from pathlib import Path
-from typing import Iterator
-from typing import Union
import pytest
from _pytest._py.path import LocalPath
@@ -15,6 +15,13 @@
logger = logging.getLogger(__name__)
+def assert_1_item_passed(output):
+ if sys.version_info >= (3, 13):
+ assert "1 item passed all tests" in output
+ else:
+ assert "1 items passed all tests" in output
+
+
class SphinxDoctestRunner:
def __init__(self, tmp_path: Path) -> None:
self.tmp_path: Path = tmp_path
@@ -50,7 +57,7 @@
if sphinxopts:
cmd.append(sphinxopts)
- def to_str(subprocess_output: Union[str, bytes]) -> str:
+ def to_str(subprocess_output: str | bytes) -> str:
if isinstance(subprocess_output, bytes):
output_str = "\n".join(subprocess_output.decode().splitlines())
else:
@@ -72,7 +79,6 @@
def test_simple_doctest_failure(sphinx_tester: SphinxDoctestRunner) -> None:
-
output = sphinx_tester(
"""
===!!!
@@ -106,7 +112,7 @@
6
"""
)
- assert "1 items passed all tests" in output
+ assert_1_item_passed(output)
class TestDirectives:
@@ -124,7 +130,7 @@
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -140,7 +146,7 @@
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -171,7 +177,7 @@
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -180,18 +186,16 @@
def test_skipif_true(
self, testdir: Testdir, sphinx_tester: SphinxDoctestRunner, testcode:
str
) -> None:
- code = """
+ code = f"""
.. testcode::
- {}
+ {testcode}
.. testoutput::
:skipif: True
NOT EVALUATED
- """.format(
- testcode
- )
+ """
raise_in_testcode = testcode != "pass"
sphinx_output = sphinx_tester(code, must_raise=raise_in_testcode)
@@ -204,7 +208,7 @@
assert "1 failure in tests" in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 failed in *"])
else:
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize(
@@ -213,18 +217,16 @@
def test_skipif_false(
self, testdir: Testdir, sphinx_tester: SphinxDoctestRunner, testcode:
str
) -> None:
- code = """
+ code = f"""
.. testcode::
- {}
+ {testcode}
.. testoutput::
:skipif: False
EVALUATED
- """.format(
- testcode
- )
+ """
expected_failure = "EVALUATED" not in testcode
@@ -235,7 +237,7 @@
assert "1 failure in tests" in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 failed in *"])
else:
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize("wrong_output_assertion", [True, False])
@@ -264,9 +266,7 @@
Traceback (most recent call last):
...
{}
- """.format(
- "ValueError" if wrong_output_assertion else "RuntimeError"
- )
+ """.format("ValueError" if wrong_output_assertion else
"RuntimeError")
# -> ignore all skipped testoutput sections, but use the one that is
# -> not skipped
@@ -279,26 +279,24 @@
assert "1 failure in tests" in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 failed in *"])
else:
- assert "1 items passed all tests" in sphinx_output
+ assert_1_item_passed(sphinx_output)
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize("testcode", ["raise RuntimeError", "pass",
"print(1234)"])
def test_skipif_true_in_testcode(
self, testdir: Testdir, sphinx_tester: SphinxDoctestRunner, testcode:
str
) -> None:
- code = """
+ code = f"""
.. testcode::
:skipif: True
- {}
+ {testcode}
.. testoutput::
:skipif: False
NOT EVALUATED
- """.format(
- testcode
- )
+ """
sphinx_output = sphinx_tester(code, must_raise=False)
assert "0 tests" in sphinx_output
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-sphinx-0.6.3/tox.ini
new/pytest-sphinx-0.7.1/tox.ini
--- old/pytest-sphinx-0.6.3/tox.ini 2024-04-13 21:08:58.000000000 +0200
+++ new/pytest-sphinx-0.7.1/tox.ini 2026-01-21 19:58:57.000000000 +0100
@@ -1,6 +1,6 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
-envlist = py37,py38,py39,py310,py311,ci-py
+envlist = py310,py311,py312,py313,py314,ci-py
isolated_build = true
[testenv]