Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pytest-doctestplus for
openSUSE:Factory checked in at 2023-07-25 11:51:24
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-doctestplus (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-doctestplus.new.1467 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-doctestplus"
Tue Jul 25 11:51:24 2023 rev:15 rq:1100443 version:0.13.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-doctestplus/python-pytest-doctestplus.changes
2023-05-05 15:58:50.540620435 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-doctestplus.new.1467/python-pytest-doctestplus.changes
2023-07-25 11:53:14.806205516 +0200
@@ -1,0 +2,9 @@
+Mon Jul 24 18:57:08 UTC 2023 - Dirk Müller <[email protected]>
+
+- update to 0.13.0:
+ * Compatibility with pytest 7.4 with respect to
+ ``norecursedirs`` handling. [#201]
+ * Respect ``--doctest-continue-on-failure`` flag. [#197]
+ * Report doctests raising skip exceptions as skipped. [#196]
+
+-------------------------------------------------------------------
Old:
----
pytest-doctestplus-0.12.1.tar.gz
New:
----
pytest-doctestplus-0.13.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-doctestplus.spec ++++++
--- /var/tmp/diff_new_pack.0bW04s/_old 2023-07-25 11:53:15.862211699 +0200
+++ /var/tmp/diff_new_pack.0bW04s/_new 2023-07-25 11:53:15.870211746 +0200
@@ -27,7 +27,7 @@
%{?sle15_python_module_pythons}
Name: python-pytest-doctestplus%{psuffix}
-Version: 0.12.1
+Version: 0.13.0
Release: 0
Summary: Pytest plugin with advanced doctest features
License: BSD-3-Clause
++++++ pytest-doctestplus-0.12.1.tar.gz -> pytest-doctestplus-0.13.0.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/.github/workflows/publish.yml
new/pytest-doctestplus-0.13.0/.github/workflows/publish.yml
--- old/pytest-doctestplus-0.12.1/.github/workflows/publish.yml 2022-09-26
21:22:32.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/.github/workflows/publish.yml 2023-06-08
07:19:59.000000000 +0200
@@ -13,10 +13,10 @@
if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags'))
|| contains(github.event.pull_request.labels.*.name, 'Build wheels'))
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v4
with:
python-version: 3.8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/.github/workflows/python-tests.yml
new/pytest-doctestplus-0.13.0/.github/workflows/python-tests.yml
--- old/pytest-doctestplus-0.12.1/.github/workflows/python-tests.yml
2022-09-26 21:22:32.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/.github/workflows/python-tests.yml
2023-06-08 07:19:59.000000000 +0200
@@ -5,6 +5,7 @@
push:
branches: [ main ]
tags:
+ - '*'
workflow_dispatch:
schedule:
# Run every Sunday at 03:53 UTC
@@ -42,19 +43,19 @@
python-version: 3.9
toxenv: py39-test-pytest62
- os: macos-latest
- python-version: 3.8
- toxenv: py38-test-pytestdev
+ python-version: '3.11'
+ toxenv: py311-test-pytestdev
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-pytest70
toxargs: --pre
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Tox
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/.mailmap
new/pytest-doctestplus-0.13.0/.mailmap
--- old/pytest-doctestplus-0.12.1/.mailmap 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-doctestplus-0.13.0/.mailmap 2023-06-08 07:19:59.000000000
+0200
@@ -0,0 +1,18 @@
+Brigitta SipÅcz <[email protected]>
+Brigitta SipÅcz <[email protected]> <[email protected]>
+Dan D'Avella <[email protected]>
+Dan D'Avella <[email protected]> <[email protected]>
+E. Madison Bray <[email protected]>
+E. Madison Bray <[email protected]> <[email protected]>
+Hans Moritz Günther <[email protected]>
+Kirill Tchernyshyov <[email protected]>
+Leo Singer <[email protected]> <[email protected]>
+Matt Davis <[email protected]>
+Matteo Bachetti <[email protected]>
+Matteo Bachetti <[email protected]>
<[email protected]>
+Michael Seifert <[email protected]>
+Pey Lian Lim <[email protected]>
<[email protected]>
+Pratik Patel <[email protected]>
+Simon Conseil <[email protected]> <[email protected]>
+Simon Conseil <[email protected]> <[email protected]>
+Tinuade Adeleke <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/CHANGES.rst
new/pytest-doctestplus-0.13.0/CHANGES.rst
--- old/pytest-doctestplus-0.12.1/CHANGES.rst 2022-09-26 21:22:32.000000000
+0200
+++ new/pytest-doctestplus-0.13.0/CHANGES.rst 2023-06-08 07:19:59.000000000
+0200
@@ -1,3 +1,12 @@
+0.13.0 (2023-06-07)
+===================
+
+- Compatibility with pytest 7.4 with respect to ``norecursedirs`` handling.
[#201]
+
+- Respect ``--doctest-continue-on-failure`` flag. [#197]
+
+- Report doctests raising skip exceptions as skipped. [#196]
+
0.12.1 (2022-09-26)
===================
@@ -6,7 +15,7 @@
0.12.0 (2022-02-25)
===================
-- Run doctests in docstrings of Numpy ufuncs. [#123, #174]
+- Run doctests in docstrings of Numpy ufuncs. [#174, #175]
0.11.2 (2021-12-09)
===================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/LICENSE.rst
new/pytest-doctestplus-0.13.0/LICENSE.rst
--- old/pytest-doctestplus-0.12.1/LICENSE.rst 2022-09-26 21:22:32.000000000
+0200
+++ new/pytest-doctestplus-0.13.0/LICENSE.rst 2023-06-08 07:19:59.000000000
+0200
@@ -1,4 +1,4 @@
-Copyright (c) 2011-2017, Astropy Developers
+Copyright (c) 2011-2023, Astropy Developers
All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/PKG-INFO
new/pytest-doctestplus-0.13.0/PKG-INFO
--- old/pytest-doctestplus-0.12.1/PKG-INFO 2022-09-26 21:22:59.767977500
+0200
+++ new/pytest-doctestplus-0.13.0/PKG-INFO 2023-06-08 07:20:18.047553800
+0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-doctestplus
-Version: 0.12.1
+Version: 0.13.0
Summary: Pytest plugin with advanced doctest features.
Home-page: https://github.com/astropy/pytest-doctestplus
Author: The Astropy Developers
@@ -123,6 +123,12 @@
``pytest-doctestplus`` plugin will be used, regardless of the contents of
``setup.cfg``.
+``pytest-doctestplus`` respects the ``--doctest-continue-on-failure`` flag.
+If set, doctests will report all failing lines, which may be useful to detect
+independent errors within the same doctest. However, it is likely to generate
+false positives when an early failure causes a variable later lines access to
+remain unset or have an unexpected value.
+
This plugin respects the doctest options that are used by the built-in doctest
plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default,
``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all
@@ -246,6 +252,22 @@
However, it is often useful to be able to skip docstrings associated with
particular functions, methods, classes, or even entire files.
+Skipping All the Tests
+^^^^^^^^^^^^^^^^^^^^^^
+
+It is also possible to skip all doctests below a certain line using
+a ``doctest-skip-all`` comment. Note the lack of ``::`` at the end
+of the line here.
+
+.. code-block:: rst
+
+ .. doctest-skip-all
+
+ >>> import non_existing
+ >>> non_existing.write_pseudo_code()
+ All the doctests are skipped in the file below
+
+
Skip Unconditionally
^^^^^^^^^^^^^^^^^^^^
@@ -300,6 +322,16 @@
>>> import asdf
>>> asdf.open('file.asdf')
+
+Furthermore, if the code only runs for specific versions of the optional
dependency,
+you can add a version check like this:
+
+.. code-block:: rst
+
+ .. doctest-requires:: asdf<3
+
+ >>> import asdf
+ >>> asdf.open('file.asdf')
Finally, it is possible to skip collecting doctests in entire subpackages by
using the ``doctest_subpackage_requires`` in the ``[tool:pytest]`` section of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/README.rst
new/pytest-doctestplus-0.13.0/README.rst
--- old/pytest-doctestplus-0.12.1/README.rst 2022-09-26 21:22:32.000000000
+0200
+++ new/pytest-doctestplus-0.13.0/README.rst 2023-06-08 07:19:59.000000000
+0200
@@ -94,6 +94,12 @@
``pytest-doctestplus`` plugin will be used, regardless of the contents of
``setup.cfg``.
+``pytest-doctestplus`` respects the ``--doctest-continue-on-failure`` flag.
+If set, doctests will report all failing lines, which may be useful to detect
+independent errors within the same doctest. However, it is likely to generate
+false positives when an early failure causes a variable later lines access to
+remain unset or have an unexpected value.
+
This plugin respects the doctest options that are used by the built-in doctest
plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default,
``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all
@@ -217,6 +223,22 @@
However, it is often useful to be able to skip docstrings associated with
particular functions, methods, classes, or even entire files.
+Skipping All the Tests
+^^^^^^^^^^^^^^^^^^^^^^
+
+It is also possible to skip all doctests below a certain line using
+a ``doctest-skip-all`` comment. Note the lack of ``::`` at the end
+of the line here.
+
+.. code-block:: rst
+
+ .. doctest-skip-all
+
+ >>> import non_existing
+ >>> non_existing.write_pseudo_code()
+ All the doctests are skipped in the file below
+
+
Skip Unconditionally
^^^^^^^^^^^^^^^^^^^^
@@ -271,6 +293,16 @@
>>> import asdf
>>> asdf.open('file.asdf')
+
+Furthermore, if the code only runs for specific versions of the optional
dependency,
+you can add a version check like this:
+
+.. code-block:: rst
+
+ .. doctest-requires:: asdf<3
+
+ >>> import asdf
+ >>> asdf.open('file.asdf')
Finally, it is possible to skip collecting doctests in entire subpackages by
using the ``doctest_subpackage_requires`` in the ``[tool:pytest]`` section of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/pytest_doctestplus/plugin.py
new/pytest-doctestplus-0.13.0/pytest_doctestplus/plugin.py
--- old/pytest-doctestplus-0.12.1/pytest_doctestplus/plugin.py 2022-09-26
21:22:32.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/pytest_doctestplus/plugin.py 2023-06-08
07:19:59.000000000 +0200
@@ -11,8 +11,11 @@
import warnings
from pathlib import Path
from textwrap import indent
+from unittest import SkipTest
import pytest
+from _pytest.outcomes import OutcomeException # Private API, but been around
since 3.7
+from _pytest.doctest import _get_continue_on_failure # Since 3.5, still in 7.3
from packaging.version import Version
from pytest_doctestplus.utils import ModuleChecker
@@ -258,8 +261,13 @@
# uses internal doctest module parsing mechanism
finder = DocTestFinderPlus(doctest_ufunc=use_doctest_ufunc)
- runner = doctest.DebugRunner(
- verbose=False, optionflags=options, checker=OutputChecker())
+ runner = DebugRunnerPlus(
+ verbose=False,
+ optionflags=options,
+ checker=OutputChecker(),
+ # Helper disables continue-on-failure when debugging is enabled
+ continue_on_failure=_get_continue_on_failure(config),
+ )
for test in finder.find(module):
if test.examples: # skip empty doctests
@@ -320,8 +328,10 @@
optionflags = get_optionflags(self) | FIX
- runner = doctest.DebugRunner(
- verbose=False, optionflags=optionflags,
checker=OutputChecker())
+ runner = DebugRunnerPlus(
+ verbose=False, optionflags=optionflags,
checker=OutputChecker(),
+ continue_on_failure=_get_continue_on_failure(self.config),
+ )
parser = DocTestParserPlus()
test = parser.get_doctest(text, globs, filepath, filename, 0)
@@ -499,16 +509,12 @@
"""
if PYTEST_GE_7_0:
dirpath = Path(path).parent
- else:
- dirpath = path.dirpath()
-
- try:
- collect_ignore = config._getconftest_pathlist("collect_ignore",
path=dirpath)
- except TypeError:
- # Pytest 7.0+
collect_ignore = config._getconftest_pathlist("collect_ignore",
path=dirpath,
rootpath=config.rootpath)
+ else:
+ dirpath = path.dirpath()
+ collect_ignore = config._getconftest_pathlist("collect_ignore",
path=dirpath)
# The collect_ignore conftest.py variable should cause all test
# runners to ignore this file and all subfiles and subdirectories
@@ -548,7 +554,7 @@
self._ignore_paths.append(path)
break
- return False
+ # None = Let other plugins decide the outcome.
def pytest_collect_file(self, path, parent):
"""Implements an enhanced version of the doctest module from py.test
@@ -675,9 +681,10 @@
if name is None and hasattr(obj, '__name__'):
name = obj.__name__
else:
- raise ValueError("DocTestFinder.find: name must be given "
- "when obj.__name__ doesn't exist: {!r}"
- .format((type(obj),)))
+ raise ValueError(
+ "DocTestFinder.find: name must be given when obj.__name__
doesn't exist: "
+ f"{type(obj)!r}"
+ )
if self._doctest_ufunc:
for ufunc_name, ufunc_method in obj.__dict__.items():
@@ -711,3 +718,26 @@
tests = list(filter(test_filter, tests))
return tests
+
+
+class DebugRunnerPlus(doctest.DebugRunner):
+ def __init__(self, checker=None, verbose=None, optionflags=0,
continue_on_failure=True):
+ super().__init__(checker=checker, verbose=verbose,
optionflags=optionflags)
+ self.continue_on_failure = continue_on_failure
+
+ def report_failure(self, out, test, example, got):
+ failure = doctest.DocTestFailure(test, example, got)
+ if self.continue_on_failure:
+ out.append(failure)
+ else:
+ raise failure
+
+ def report_unexpected_exception(self, out, test, example, exc_info):
+ cls, exception, traceback = exc_info
+ if isinstance(exception, (OutcomeException, SkipTest)):
+ raise exception
+ failure = doctest.UnexpectedException(test, example, exc_info)
+ if self.continue_on_failure:
+ out.append(failure)
+ else:
+ raise failure
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/pytest_doctestplus/version.py
new/pytest-doctestplus-0.13.0/pytest_doctestplus/version.py
--- old/pytest-doctestplus-0.12.1/pytest_doctestplus/version.py 2022-09-26
21:22:59.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/pytest_doctestplus/version.py 2023-06-08
07:20:17.000000000 +0200
@@ -1,5 +1,4 @@
-# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
-__version__ = version = '0.12.1'
-__version_tuple__ = version_tuple = (0, 12, 1)
+__version__ = version = '0.13.0'
+__version_tuple__ = version_tuple = (0, 13, 0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/pytest_doctestplus.egg-info/PKG-INFO
new/pytest-doctestplus-0.13.0/pytest_doctestplus.egg-info/PKG-INFO
--- old/pytest-doctestplus-0.12.1/pytest_doctestplus.egg-info/PKG-INFO
2022-09-26 21:22:59.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/pytest_doctestplus.egg-info/PKG-INFO
2023-06-08 07:20:17.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pytest-doctestplus
-Version: 0.12.1
+Version: 0.13.0
Summary: Pytest plugin with advanced doctest features.
Home-page: https://github.com/astropy/pytest-doctestplus
Author: The Astropy Developers
@@ -123,6 +123,12 @@
``pytest-doctestplus`` plugin will be used, regardless of the contents of
``setup.cfg``.
+``pytest-doctestplus`` respects the ``--doctest-continue-on-failure`` flag.
+If set, doctests will report all failing lines, which may be useful to detect
+independent errors within the same doctest. However, it is likely to generate
+false positives when an early failure causes a variable later lines access to
+remain unset or have an unexpected value.
+
This plugin respects the doctest options that are used by the built-in doctest
plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default,
``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all
@@ -246,6 +252,22 @@
However, it is often useful to be able to skip docstrings associated with
particular functions, methods, classes, or even entire files.
+Skipping All the Tests
+^^^^^^^^^^^^^^^^^^^^^^
+
+It is also possible to skip all doctests below a certain line using
+a ``doctest-skip-all`` comment. Note the lack of ``::`` at the end
+of the line here.
+
+.. code-block:: rst
+
+ .. doctest-skip-all
+
+ >>> import non_existing
+ >>> non_existing.write_pseudo_code()
+ All the doctests are skipped in the file below
+
+
Skip Unconditionally
^^^^^^^^^^^^^^^^^^^^
@@ -300,6 +322,16 @@
>>> import asdf
>>> asdf.open('file.asdf')
+
+Furthermore, if the code only runs for specific versions of the optional
dependency,
+you can add a version check like this:
+
+.. code-block:: rst
+
+ .. doctest-requires:: asdf<3
+
+ >>> import asdf
+ >>> asdf.open('file.asdf')
Finally, it is possible to skip collecting doctests in entire subpackages by
using the ``doctest_subpackage_requires`` in the ``[tool:pytest]`` section of
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-doctestplus-0.12.1/pytest_doctestplus.egg-info/SOURCES.txt
new/pytest-doctestplus-0.13.0/pytest_doctestplus.egg-info/SOURCES.txt
--- old/pytest-doctestplus-0.12.1/pytest_doctestplus.egg-info/SOURCES.txt
2022-09-26 21:22:59.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/pytest_doctestplus.egg-info/SOURCES.txt
2023-06-08 07:20:18.000000000 +0200
@@ -1,4 +1,5 @@
.gitignore
+.mailmap
CHANGES.rst
LICENSE.rst
MANIFEST.in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/tests/conf.py
new/pytest-doctestplus-0.13.0/tests/conf.py
--- old/pytest-doctestplus-0.12.1/tests/conf.py 2022-09-26 21:22:32.000000000
+0200
+++ new/pytest-doctestplus-0.13.0/tests/conf.py 2023-06-08 07:19:59.000000000
+0200
@@ -18,7 +18,7 @@
# -- Project information -----------------------------------------------------
project = 'pytest-doctestplus'
-copyright = '2021, Astropy Infrastructure Team'
+copyright = '2011-2023, Astropy Infrastructure Team'
author = 'Astropy Infrastructure Team'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/tests/test_doctestplus.py
new/pytest-doctestplus-0.13.0/tests/test_doctestplus.py
--- old/pytest-doctestplus-0.12.1/tests/test_doctestplus.py 2022-09-26
21:22:32.000000000 +0200
+++ new/pytest-doctestplus-0.13.0/tests/test_doctestplus.py 2023-06-08
07:19:59.000000000 +0200
@@ -1,6 +1,5 @@
import glob
import os
-from packaging.version import Version
from textwrap import dedent
import sys
@@ -676,35 +675,34 @@
).assertoutcome(passed=2)
-if Version('4.3.0') <= Version(pytest.__version__):
- def test_ignore_glob_option(testdir):
- testdir.makepyfile(foo="""
- def f():
- '''
- >>> 1+1
- 2
- '''
- pass
- """)
- testdir.makepyfile(bar="""
- def f():
- '''
- >>> 1+1
- 2
- '''
- pass
- """)
- testdir.makefile('.rst', foo='>>> 1+1\n2')
+def test_ignore_glob_option(testdir):
+ testdir.makepyfile(foo="""
+ def f():
+ '''
+ >>> 1+1
+ 2
+ '''
+ pass
+ """)
+ testdir.makepyfile(bar="""
+ def f():
+ '''
+ >>> 1+1
+ 2
+ '''
+ pass
+ """)
+ testdir.makefile('.rst', foo='>>> 1+1\n2')
- testdir.inline_run(
- '--doctest-plus', '--doctest-rst', '--ignore-glob', 'foo*'
- ).assertoutcome(passed=1)
- testdir.inline_run(
- '--doctest-plus', '--doctest-rst', '--ignore-glob', 'bar*'
- ).assertoutcome(passed=2)
- testdir.inline_run(
- '--doctest-plus', '--doctest-rst', '--ignore-glob', '*.rst'
- ).assertoutcome(passed=2)
+ testdir.inline_run(
+ '--doctest-plus', '--doctest-rst', '--ignore-glob', 'foo*'
+ ).assertoutcome(passed=1)
+ testdir.inline_run(
+ '--doctest-plus', '--doctest-rst', '--ignore-glob', 'bar*'
+ ).assertoutcome(passed=2)
+ testdir.inline_run(
+ '--doctest-plus', '--doctest-rst', '--ignore-glob', '*.rst'
+ ).assertoutcome(passed=2)
def test_doctest_only(testdir, makepyfile, maketestfile, makerstfile):
@@ -731,7 +729,7 @@
testdir.inline_run("--doctest-only",
"--doctest-rst").assertoutcome(passed=3, failed=2)
-def test_doctest_float_replacement(tmpdir):
+def test_doctest_float_replacement(tmp_path):
test1 = dedent("""
This will demonstrate a doctest that fails due to a few extra decimal
places::
@@ -748,17 +746,27 @@
0.333333333333333311
""")
- test1_rst = tmpdir.join('test1.rst')
- test2_rst = tmpdir.join('test2.rst')
- test1_rst.write(test1)
- test2_rst.write(test2)
+ test1_rst = tmp_path / "test1.rst"
+ test2_rst = tmp_path / "test2.rst"
+ test1_rst.write_text(test1)
+ test2_rst.write_text(test2)
with pytest.raises(doctest.DocTestFailure):
- doctest.testfile(str(test1_rst), module_relative=False,
- raise_on_error=True, verbose=False, encoding='utf-8')
+ doctest.testfile(
+ test1_rst,
+ module_relative=False,
+ raise_on_error=True,
+ verbose=False,
+ encoding="utf-8",
+ )
- doctest.testfile(str(test2_rst), module_relative=False,
- raise_on_error=True, verbose=False, encoding='utf-8')
+ doctest.testfile(
+ test2_rst,
+ module_relative=False,
+ raise_on_error=True,
+ verbose=False,
+ encoding="utf-8",
+ )
def test_doctest_subpackage_requires(testdir, caplog):
@@ -957,6 +965,80 @@
testdir.inline_run(p, '--doctest-plus',
'--doctest-rst').assertoutcome(skipped=1)
+def test_skiptest(testdir):
+ testdir.makeini(
+ """
+ [pytest]
+ doctestplus = enabled
+ """
+ )
+ p = testdir.makepyfile(
+ """
+ class MyClass:
+ '''
+ >>> import pytest
+ >>> pytest.skip("I changed my mind")
+ >>> assert False, "This should not be reached"
+ '''
+ pass
+ """
+ )
+ reprec = testdir.inline_run(p, "--doctest-plus")
+ reprec.assertoutcome(skipped=1, failed=0)
+
+
[email protected]('cont_on_fail', [False, True])
+def test_fail_two_tests(testdir, cont_on_fail):
+ p = testdir.makepyfile(
+ """
+ class MyClass:
+ '''
+ .. doctest::
+
+ >>> print(2)
+ 1
+
+ .. doctest::
+
+ >>> print(3)
+ 1
+ '''
+ pass
+ """
+ )
+ arg = ("--doctest-continue-on-failure",) if cont_on_fail else ()
+ reprec = testdir.inline_run(p, "--doctest-plus", *arg)
+ reprec.assertoutcome(skipped=0, failed=1)
+ _, _, failed = reprec.listoutcomes()
+ report = failed[0]
+ assert "Expected:\n 1\nGot:\n 2" in report.longreprtext
+ assert ("Expected:\n 1\nGot:\n 3" in report.longreprtext) is
cont_on_fail
+
+
[email protected]('cont_on_fail', [False, True])
+def test_fail_data_dependency(testdir, cont_on_fail):
+ p = testdir.makepyfile(
+ """
+ class MyClass:
+ '''
+ .. doctest::
+
+ >>> import nonexistentmodule as nem
+ >>> a = nem.calculate_something()
+ '''
+ pass
+ """
+ )
+ arg = ("--doctest-continue-on-failure",) if cont_on_fail else ()
+ reprec = testdir.inline_run(p, "--doctest-plus", *arg)
+ reprec.assertoutcome(skipped=0, failed=1)
+ _, _, failed = reprec.listoutcomes()
+ # Both lines fail in a single error
+ report = failed[0]
+ assert " as nem\nUNEXPECTED EXCEPTION: ModuleNotFoundError" in
report.longreprtext
+ assert ("something()\nUNEXPECTED EXCEPTION: NameError" in
report.longreprtext) is cont_on_fail
+
+
def test_ufunc(testdir):
pytest.importorskip('numpy')
@@ -1060,3 +1142,26 @@
result = testdir.inline_run(build_dir, '--doctest-plus',
'--doctest-modules', '--doctest-ufunc')
result.assertoutcome(passed=2, failed=0)
+
+
+def test_norecursedirs(testdir):
+ testdir.makeini(
+ """
+ [pytest]
+ norecursedirs = \"bad_dir\"
+ doctestplus = enabled
+ """
+ )
+ subdir = testdir.mkdir("bad_dir")
+ badfile = subdir.join("test_foobar.py")
+ badfile.write_text("""
+ def f():
+ '''
+ >>> x = 1/3.
+ >>> x
+ 0.333333
+ '''
+ fail
+ """, "utf-8")
+ reprec = testdir.inline_run(str(testdir), "--doctest-plus")
+ reprec.assertoutcome(failed=0, passed=0)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-doctestplus-0.12.1/tox.ini
new/pytest-doctestplus-0.13.0/tox.ini
--- old/pytest-doctestplus-0.12.1/tox.ini 2022-09-26 21:22:32.000000000
+0200
+++ new/pytest-doctestplus-0.13.0/tox.ini 2023-06-08 07:19:59.000000000
+0200
@@ -1,6 +1,6 @@
[tox]
envlist =
- py{37,38,39,310}-test
+ py{37,38,39,310,311}-test
codestyle
requires =
setuptools >= 30.3.0