- Add patch support-python-313.patch:

* Support Python 3.13 doctest changes.
- Switch to autosetup macro.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-sphinx?expand=0&rev=19
This commit is contained in:
2024-12-12 04:44:30 +00:00
committed by Git OBS Bridge
commit 949bae6ef7
6 changed files with 270 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15e8f4adc44bd07f6333c327b3f1c14d3da06ed89141063319693201f050ddd8
size 17264

View File

@@ -0,0 +1,74 @@
-------------------------------------------------------------------
Thu Dec 12 04:44:11 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-313.patch:
* Support Python 3.13 doctest changes.
- Switch to autosetup macro.
-------------------------------------------------------------------
Wed Aug 14 14:54:31 UTC 2024 - Dirk Müller <dmueller@suse.com>
- switch to modern python for sle15
-------------------------------------------------------------------
Tue May 7 04:40:27 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 0.6.3:
* Forgot to bump minimum required pytest version in pytest-sphinx 0.6.2 #64
* Adapt to incompatible `import_path` API change in pytest 8.1.1. Pytest
8.1.1 is required by pytest-sphinx now.
* Require pytest >= 8.0 #59
* Drop support for python 3.7 #59
-------------------------------------------------------------------
Mon May 8 08:26:45 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.5.0:
* Mention in the README that the doctest directive is
supported.
* CI improvements
-------------------------------------------------------------------
Mon Apr 25 06:23:43 UTC 2022 - Markéta Machová <mmachova@suse.com>
- Update to 0.4.0
* Drop python2.7 (Fixes #14)
* Drop python3.5 and python3.6
* Require pytest>=7.0
-------------------------------------------------------------------
Fri Aug 21 12:55:42 UTC 2020 - Marketa Calabkova <mcalabkova@suse.com>
- Update to 0.3.1
* Adapt to importmode API changes in pytest-6.0
* Adapt to Node API changes in pytest-5.4 (Fixes #11)
* Add support for python 3.8 (Fixes #15)
* Add support for skipif option in testoutput directive (Fixes #17)
* Add support for skipif option in testcode directive (Fixes #21)
* A ValueError is raised if the text inside the directives is not properly
formatted.
* Ignore the option :hide: in directives (Fixes #19)
* Fix detection of block boundaries in parser.
-------------------------------------------------------------------
Fri Jun 5 13:57:25 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Package doesn't work with pytest 5.*
-------------------------------------------------------------------
Mon Apr 20 10:25:24 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix build without python2
-------------------------------------------------------------------
Fri Sep 6 18:20:35 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Update to v0.2.2
* Add hack for handling mock style objects
* Add support for indented directives
-------------------------------------------------------------------
Thu Mar 21 01:44:43 PM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.2.1

65
python-pytest-sphinx.spec Normal file
View File

@@ -0,0 +1,65 @@
#
# spec file for package python-pytest-sphinx
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-pytest-sphinx
Version: 0.6.3
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 pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pytest >= 8.1.1
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Sphinx}
BuildRequires: %{python_module pytest >= 8.1.1}
# /SECTION
%python_subpackages
%description
Doctest plugin for pytest with support for Sphinx-specific doctest-directives.
%prep
%autosetup -p1 -n pytest-sphinx-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/pytest_sphinx.py
%{python_sitelib}/pytest_sphinx-%{version}.dist-info
%pycache_only %{python_sitelib}/__pycache__/pytest_sphinx*pyc
%changelog

104
support-python-313.patch Normal file
View File

@@ -0,0 +1,104 @@
Index: pytest-sphinx-0.6.3/src/pytest_sphinx.py
===================================================================
--- pytest-sphinx-0.6.3.orig/src/pytest_sphinx.py
+++ pytest-sphinx-0.6.3/src/pytest_sphinx.py
@@ -495,7 +495,12 @@ class SphinxDocTestRunner(doctest.DebugR
self.optionflags = original_optionflags
# Record and return the number of failures and tries.
- self._DocTestRunner__record_outcome(test, failures, tries) # type:ignore
+ # And for Python 3.13 and above, also pass the number of skips, which
+ # is always zero if we got here.
+ if sys.version_info[:2] >= (3, 13):
+ self._DocTestRunner__record_outcome(test, failures, tries, 0) # type:ignore
+ else:
+ self._DocTestRunner__record_outcome(test, failures, tries) # type:ignore
return doctest.TestResults(failures, tries)
Index: pytest-sphinx-0.6.3/tests/test_sphinx_doctest.py
===================================================================
--- pytest-sphinx-0.6.3.orig/tests/test_sphinx_doctest.py
+++ pytest-sphinx-0.6.3/tests/test_sphinx_doctest.py
@@ -3,6 +3,7 @@
import logging
import os
import subprocess
+import sys
import textwrap
from pathlib import Path
from typing import Iterator
@@ -14,6 +15,10 @@ from _pytest.legacypath import Testdir
logger = logging.getLogger(__name__)
+testoutput = "1 items passed all tests"
+if sys.version_info[:2] >= (3, 13):
+ testoutput = "Testing of doctests in the sources finished"
+
class SphinxDoctestRunner:
def __init__(self, tmp_path: Path) -> None:
@@ -106,7 +111,7 @@ def test_simple_doctest_success(sphinx_t
6
"""
)
- assert "1 items passed all tests" in output
+ assert testoutput in output
class TestDirectives:
@@ -124,7 +129,7 @@ class TestDirectives:
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert testoutput in sphinx_output
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -140,7 +145,7 @@ class TestDirectives:
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert testoutput in sphinx_output
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -171,7 +176,7 @@ class TestDirectives:
"""
sphinx_output = sphinx_tester(code)
- assert "1 items passed all tests" in sphinx_output
+ assert testoutput in sphinx_output
plugin_result = testdir.runpytest("--doctest-glob=index.rst").stdout
plugin_result.fnmatch_lines(["*=== 1 passed in *"])
@@ -204,7 +209,7 @@ class TestDirectives:
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 testoutput in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize(
@@ -235,7 +240,7 @@ class TestDirectives:
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 testoutput in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize("wrong_output_assertion", [True, False])
@@ -279,7 +284,7 @@ class TestDirectives:
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 testoutput in sphinx_output
plugin_output.fnmatch_lines(["*=== 1 passed in *"])
@pytest.mark.parametrize("testcode", ["raise RuntimeError", "pass", "print(1234)"])