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 2022-03-13 22:34:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-doctestplus (Old) and /work/SRC/openSUSE:Factory/.python-pytest-doctestplus.new.25692 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-doctestplus" Sun Mar 13 22:34:24 2022 rev:12 rq:961495 version:0.12.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-doctestplus/python-pytest-doctestplus.changes 2021-10-19 23:04:36.661294299 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-doctestplus.new.25692/python-pytest-doctestplus.changes 2022-03-13 22:34:25.366200902 +0100 @@ -1,0 +2,12 @@ +Sun Mar 13 08:57:08 UTC 2022 - Ben Greiner <c...@bnavigator.de> + +- Update to 0.12.0 + * MNT: Stop using distutils by @pllim in #172 + * Add --doctest-ufunc option to doctest Numpy ufuncs by @lpsinger + in #174 + * Fix typos by @kianmeng in #176 + * Doctests in ufuncs should respect doctest_skip by @lpsinger in + #175 + * Use windows-2019 for GitHub Actions jobs by @lpsinger in #178 + +------------------------------------------------------------------- Old: ---- pytest-doctestplus-0.11.0.tar.gz New: ---- pytest-doctestplus-0.12.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-doctestplus.spec ++++++ --- /var/tmp/diff_new_pack.9jhzLp/_old 2022-03-13 22:34:26.014203316 +0100 +++ /var/tmp/diff_new_pack.9jhzLp/_new 2022-03-13 22:34:26.018203330 +0100 @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,11 +24,11 @@ %define psuffix %{nil} %bcond_with test %endif + +%{?!python_module:%define python_module() python3-%{**}} %define skip_python2 1 -%define skip_python36 1 -%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pytest-doctestplus%{psuffix} -Version: 0.11.0 +Version: 0.12.0 Release: 0 Summary: Pytest plugin with advanced doctest features License: BSD-3-Clause @@ -43,12 +43,15 @@ Requires: python-packaging >= 17.0 Requires: python-pytest >= 4.6 Requires: python-setuptools >= 30.3.0 -BuildArch: noarch %if %{with test} BuildRequires: %{python_module Sphinx} +BuildRequires: %{python_module numpy} +BuildRequires: %{python_module numpy-devel} BuildRequires: %{python_module pip >= 19.3.1} BuildRequires: %{python_module pytest-doctestplus = %{version}} BuildRequires: %{python_module pytest-remotedata = 0.3.2} +%else +BuildArch: noarch %endif %python_subpackages ++++++ pytest-doctestplus-0.11.0.tar.gz -> pytest-doctestplus-0.12.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/.github/workflows/python-tests.yml new/pytest-doctestplus-0.12.0/.github/workflows/python-tests.yml --- old/pytest-doctestplus-0.11.0/.github/workflows/python-tests.yml 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/.github/workflows/python-tests.yml 2022-02-25 20:54:11.000000000 +0100 @@ -20,7 +20,7 @@ - os: ubuntu-latest python-version: 3.7 toxenv: py37-test-pytest46 - - os: windows-latest + - os: windows-2019 python-version: 3.7 toxenv: py37-test-pytest50 - os: macos-latest @@ -29,7 +29,7 @@ - os: ubuntu-latest python-version: 3.7 toxenv: py37-test-pytest52 - - os: windows-latest + - os: windows-2019 python-version: 3.8 toxenv: py38-test-pytest53 - os: ubuntu-latest @@ -44,6 +44,10 @@ - os: macos-latest python-version: 3.8 toxenv: py38-test-pytestdev + - os: ubuntu-latest + python-version: '3.10' + toxenv: py310-test-pytest70 + toxargs: --pre steps: - uses: actions/checkout@v2 @@ -56,7 +60,7 @@ - name: Install Tox run: python -m pip install tox - name: Run Tox - run: tox -v -e ${{ matrix.toxenv }} + run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} # - name: Slack Notification # uses: 8398a7/action-slack@v3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/CHANGES.rst new/pytest-doctestplus-0.12.0/CHANGES.rst --- old/pytest-doctestplus-0.11.0/CHANGES.rst 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/CHANGES.rst 2022-02-25 20:54:11.000000000 +0100 @@ -1,9 +1,28 @@ +0.12.0 (2022-02-25) +=================== + +- Run doctests in docstrings of Numpy ufuncs. [#123, #174] + +0.11.2 (2021-12-09) +=================== + +- Fix version check for pytest 7.0.0rc1. [#171] + +- Recognize text beginning with ``<!--`` as a comment for Markdown (``.md``) + files. [#169] + +0.11.1 (2021-11-16) +=================== + +- Fixed compatibility with pytest-dev. [#168] + 0.11.0 (2021-09-20) =================== - Added support for ``testcleanup`` and documented existing support for ``testsetup``. [#165] + 0.10.1 (2021-07-20) =================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/PKG-INFO new/pytest-doctestplus-0.12.0/PKG-INFO --- old/pytest-doctestplus-0.11.0/PKG-INFO 2021-09-20 20:02:55.490045000 +0200 +++ new/pytest-doctestplus-0.12.0/PKG-INFO 2022-02-25 20:54:24.130348000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-doctestplus -Version: 0.11.0 +Version: 0.12.0 Summary: Pytest plugin with advanced doctest features. Home-page: https://github.com/astropy/pytest-doctestplus Author: The Astropy Developers @@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities @@ -31,6 +32,14 @@ pytest-doctestplus ================== +.. image:: https://zenodo.org/badge/104253824.svg + :target: https://zenodo.org/badge/latestdoi/104253824 + :alt: Zenodo DOI + +.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg + :target: https://github.com/astropy/pytest-doctestplus/actions + :alt: CI Status + This package contains a plugin for the `pytest`_ framework that provides advanced doctest support and enables the testing of `reStructuredText`_ (".rst") files. It was originally part of the `astropy`_ core package, but has @@ -63,6 +72,7 @@ * handling doctests that use remote data in conjunction with the `pytest-remotedata`_ plugin (see `Remote Data`_) * optional inclusion of ``*.rst`` files for doctests (see `Setup and Configuration`_) +* optional inclusion of doctests in docstrings of Numpy ufuncs .. _pytest-remotedata: https://github.com/astropy/pytest-remotedata @@ -91,9 +101,10 @@ Setup and Configuration ~~~~~~~~~~~~~~~~~~~~~~~ -This plugin provides two command line options: ``--doctest-plus`` for enabling -the advanced features mentioned above, and ``--doctest-rst`` for including -``*.rst`` files in doctest collection. +This plugin provides three command line options: ``--doctest-plus`` for enabling +the advanced features mentioned above, ``--doctest-rst`` for including +``*.rst`` files in doctest collection, and ``--doctest-ufunc`` for including +doctests in docstrings of Numpy ufuncs. This plugin can also be enabled by default by adding ``doctest_plus = enabled`` to the ``[tool:pytest]`` section of the package's ``setup.cfg`` file. @@ -117,7 +128,7 @@ plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default, ``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all doctest settings, see the `doctest documentation -<https://https://docs.python.org/3/library/doctest.html#option-flags>`_. +<https://docs.python.org/3/library/doctest.html#option-flags>`_. Doctest Directives ~~~~~~~~~~~~~~~~~~ @@ -346,10 +357,6 @@ Development Status ------------------ -.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg - :target: https://github.com/astropy/pytest-doctestplus/actions - :alt: CI Status - Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-doctestplus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/README.rst new/pytest-doctestplus-0.12.0/README.rst --- old/pytest-doctestplus-0.11.0/README.rst 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/README.rst 2022-02-25 20:54:11.000000000 +0100 @@ -2,6 +2,14 @@ pytest-doctestplus ================== +.. image:: https://zenodo.org/badge/104253824.svg + :target: https://zenodo.org/badge/latestdoi/104253824 + :alt: Zenodo DOI + +.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg + :target: https://github.com/astropy/pytest-doctestplus/actions + :alt: CI Status + This package contains a plugin for the `pytest`_ framework that provides advanced doctest support and enables the testing of `reStructuredText`_ (".rst") files. It was originally part of the `astropy`_ core package, but has @@ -34,6 +42,7 @@ * handling doctests that use remote data in conjunction with the `pytest-remotedata`_ plugin (see `Remote Data`_) * optional inclusion of ``*.rst`` files for doctests (see `Setup and Configuration`_) +* optional inclusion of doctests in docstrings of Numpy ufuncs .. _pytest-remotedata: https://github.com/astropy/pytest-remotedata @@ -62,9 +71,10 @@ Setup and Configuration ~~~~~~~~~~~~~~~~~~~~~~~ -This plugin provides two command line options: ``--doctest-plus`` for enabling -the advanced features mentioned above, and ``--doctest-rst`` for including -``*.rst`` files in doctest collection. +This plugin provides three command line options: ``--doctest-plus`` for enabling +the advanced features mentioned above, ``--doctest-rst`` for including +``*.rst`` files in doctest collection, and ``--doctest-ufunc`` for including +doctests in docstrings of Numpy ufuncs. This plugin can also be enabled by default by adding ``doctest_plus = enabled`` to the ``[tool:pytest]`` section of the package's ``setup.cfg`` file. @@ -88,7 +98,7 @@ plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default, ``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all doctest settings, see the `doctest documentation -<https://https://docs.python.org/3/library/doctest.html#option-flags>`_. +<https://docs.python.org/3/library/doctest.html#option-flags>`_. Doctest Directives ~~~~~~~~~~~~~~~~~~ @@ -317,10 +327,6 @@ Development Status ------------------ -.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg - :target: https://github.com/astropy/pytest-doctestplus/actions - :alt: CI Status - Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-doctestplus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus/plugin.py new/pytest-doctestplus-0.12.0/pytest_doctestplus/plugin.py --- old/pytest-doctestplus-0.11.0/pytest_doctestplus/plugin.py 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus/plugin.py 2022-02-25 20:54:11.000000000 +0100 @@ -22,13 +22,16 @@ _pytest_version = Version(pytest.__version__) PYTEST_GT_5 = _pytest_version > Version('5.9.9') -PYTEST_GE_6_3 = _pytest_version.is_devrelease or _pytest_version >= Version('6.3') -PYTEST_GT_6_3 = _pytest_version.is_devrelease or _pytest_version > Version('6.3') +PYTEST_GE_5_4 = _pytest_version >= Version('5.4') +PYTEST_GE_7_0 = any([_pytest_version.is_devrelease, + _pytest_version.is_prerelease, + _pytest_version >= Version('7.0')]) comment_characters = { '.txt': '#', '.tex': '%', - '.rst': r'\.\.' + '.rst': r'\.\.', + '.md': '<!--' } @@ -82,6 +85,10 @@ "features not found in the normal doctest " "plugin") + parser.addoption("--doctest-ufunc", action="store_true", + help="enable running doctests in docstrings of Numpy " + "ufuncs") + parser.addoption("--doctest-rst", action="store_true", help=( "Enable running doctests in .rst documentation. " @@ -118,6 +125,9 @@ parser.addini("doctest_plus", "enable running doctests with additional " "features not found in the normal doctest plugin") + parser.addini("doctest_ufunc", "enable running doctests in docstrings of " + "Numpy ufuncs") + parser.addini("doctest_norecursedirs", "like the norecursedirs option but applies only to doctest " "collection", type="args", default=()) @@ -154,11 +164,27 @@ return flag_int +def _is_numpy_ufunc(method): + try: + import numpy as np + except ModuleNotFoundError: + # If Numpy is not installed, then there can't be any ufuncs! + return False + while True: + try: + method = method.__wrapped__ + except AttributeError: + break + return isinstance(method, np.ufunc) + + def pytest_configure(config): doctest_plugin = config.pluginmanager.getplugin('doctest') run_regular_doctest = config.option.doctestmodules and not config.option.doctest_plus use_doctest_plus = config.getini( 'doctest_plus') or config.option.doctest_plus or config.option.doctest_only + use_doctest_ufunc = config.getini( + 'doctest_ufunc') or config.option.doctest_ufunc if doctest_plugin is None or run_regular_doctest or not use_doctest_plus: return @@ -191,7 +217,7 @@ def collect(self): # When running directly from pytest we need to make sure that we # don't accidentally import setup.py! - if PYTEST_GE_6_3: + if PYTEST_GE_7_0: fspath = self.path filepath = self.path.name else: @@ -201,13 +227,10 @@ if filepath == "setup.py": return elif filepath == "conftest.py": - if PYTEST_GT_6_3: + if PYTEST_GE_7_0: module = self.config.pluginmanager._importconftest( self.path, self.config.getoption("importmode"), rootpath=self.config.rootpath) - elif PYTEST_GE_6_3: - module = self.config.pluginmanager._importconftest( - self.path, self.config.getoption("importmode")) elif PYTEST_GT_5: module = self.config.pluginmanager._importconftest( self.fspath, self.config.getoption("importmode")) @@ -219,7 +242,7 @@ if PYTEST_GT_5: from _pytest.pathlib import import_path - if PYTEST_GE_6_3: + if PYTEST_GE_7_0: module = import_path(fspath, root=self.config.rootpath) elif PYTEST_GT_5: module = import_path(fspath) @@ -234,7 +257,7 @@ options = get_optionflags(self) | FIX # uses internal doctest module parsing mechanism - finder = DocTestFinderPlus() + finder = DocTestFinderPlus(doctest_ufunc=use_doctest_ufunc) runner = doctest.DebugRunner( verbose=False, optionflags=options, checker=OutputChecker()) @@ -283,7 +306,7 @@ class DocTestTextfilePlus(pytest.Module): def collect(self): - if PYTEST_GE_6_3: + if PYTEST_GE_7_0: fspath = self.path filepath = self.path.name else: @@ -474,7 +497,7 @@ Skip paths that match any of the doctest_norecursedirs patterns or if doctest_only is True then skip all regular test files (eg test_*.py). """ - if PYTEST_GE_6_3: + if PYTEST_GE_7_0: dirpath = Path(path).parent else: dirpath = path.dirpath() @@ -567,10 +590,11 @@ return None # Don't override the built-in doctest plugin - try: + if PYTEST_GE_7_0: + return self._doctest_module_item_cls.from_parent(parent, path=Path(path)) + elif PYTEST_GE_5_4: return self._doctest_module_item_cls.from_parent(parent, fspath=path) - except AttributeError: - # pytest < 5.4 + else: return self._doctest_module_item_cls(path, parent) elif any([path.check(fnmatch=pat) for pat in self._file_globs]): @@ -598,10 +622,11 @@ # TODO: Get better names on these items when they are # displayed in py.test output - try: + if PYTEST_GE_7_0: + return self._doctest_textfile_item_cls.from_parent(parent, path=Path(path)) + elif PYTEST_GE_5_4: return self._doctest_textfile_item_cls.from_parent(parent, fspath=path) - except AttributeError: - # pytest < 5.4 + else: return self._doctest_textfile_item_cls(path, parent) @@ -614,6 +639,10 @@ _import_cache = {} _module_checker = ModuleChecker() + def __init__(self, *args, doctest_ufunc=False, **kwargs): + super().__init__(*args, **kwargs) + self._doctest_ufunc = doctest_ufunc + @classmethod def check_required_modules(cls, mods): """Check that modules in `mods` list are available. @@ -642,13 +671,22 @@ def find(self, obj, name=None, module=None, globs=None, extraglobs=None): tests = doctest.DocTestFinder.find(self, obj, name, module, globs, extraglobs) + + 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),))) + + if self._doctest_ufunc: + for ufunc_name, ufunc_method in obj.__dict__.items(): + if _is_numpy_ufunc(ufunc_method): + tests += doctest.DocTestFinder.find( + self, ufunc_method, f'{name}.{ufunc_name}', + module=obj, globs=globs, extraglobs=extraglobs) + if hasattr(obj, '__doctest_skip__') or hasattr(obj, '__doctest_requires__'): - 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),))) def test_filter(test): for pat in getattr(obj, '__doctest_skip__', []): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus/sphinx/doctestplus.py new/pytest-doctestplus-0.12.0/pytest_doctestplus/sphinx/doctestplus.py --- old/pytest-doctestplus-0.11.0/pytest_doctestplus/sphinx/doctestplus.py 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus/sphinx/doctestplus.py 2022-02-25 20:54:11.000000000 +0100 @@ -19,7 +19,7 @@ def run(self): # Check if there is any valid argument, and skip it. Currently only - # 'win32' is supported in astropy.tests.pytest_plugins. + # 'win32' is supported. if re.match('win32', self.content[0]): self.content = self.content[2:] code = '\n'.join(self.content) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus/version.py new/pytest-doctestplus-0.12.0/pytest_doctestplus/version.py --- old/pytest-doctestplus-0.11.0/pytest_doctestplus/version.py 2021-09-20 20:02:55.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus/version.py 2022-02-25 20:54:23.000000000 +0100 @@ -1,5 +1,5 @@ # coding: utf-8 # file generated by setuptools_scm # don't change, don't track in version control -version = '0.11.0' -version_tuple = (0, 11, 0) +version = '0.12.0' +version_tuple = (0, 12, 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/PKG-INFO new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/PKG-INFO --- old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/PKG-INFO 2021-09-20 20:02:55.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/PKG-INFO 2022-02-25 20:54:23.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pytest-doctestplus -Version: 0.11.0 +Version: 0.12.0 Summary: Pytest plugin with advanced doctest features. Home-page: https://github.com/astropy/pytest-doctestplus Author: The Astropy Developers @@ -19,6 +19,7 @@ Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Utilities @@ -31,6 +32,14 @@ pytest-doctestplus ================== +.. image:: https://zenodo.org/badge/104253824.svg + :target: https://zenodo.org/badge/latestdoi/104253824 + :alt: Zenodo DOI + +.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg + :target: https://github.com/astropy/pytest-doctestplus/actions + :alt: CI Status + This package contains a plugin for the `pytest`_ framework that provides advanced doctest support and enables the testing of `reStructuredText`_ (".rst") files. It was originally part of the `astropy`_ core package, but has @@ -63,6 +72,7 @@ * handling doctests that use remote data in conjunction with the `pytest-remotedata`_ plugin (see `Remote Data`_) * optional inclusion of ``*.rst`` files for doctests (see `Setup and Configuration`_) +* optional inclusion of doctests in docstrings of Numpy ufuncs .. _pytest-remotedata: https://github.com/astropy/pytest-remotedata @@ -91,9 +101,10 @@ Setup and Configuration ~~~~~~~~~~~~~~~~~~~~~~~ -This plugin provides two command line options: ``--doctest-plus`` for enabling -the advanced features mentioned above, and ``--doctest-rst`` for including -``*.rst`` files in doctest collection. +This plugin provides three command line options: ``--doctest-plus`` for enabling +the advanced features mentioned above, ``--doctest-rst`` for including +``*.rst`` files in doctest collection, and ``--doctest-ufunc`` for including +doctests in docstrings of Numpy ufuncs. This plugin can also be enabled by default by adding ``doctest_plus = enabled`` to the ``[tool:pytest]`` section of the package's ``setup.cfg`` file. @@ -117,7 +128,7 @@ plugin and are set in ``doctest_optionflags`` in ``setup.cfg``. By default, ``ELLIPSIS`` and ``NORMALIZE_WHITESPACE`` are used. For a description of all doctest settings, see the `doctest documentation -<https://https://docs.python.org/3/library/doctest.html#option-flags>`_. +<https://docs.python.org/3/library/doctest.html#option-flags>`_. Doctest Directives ~~~~~~~~~~~~~~~~~~ @@ -346,10 +357,6 @@ Development Status ------------------ -.. image:: https://github.com/astropy/pytest-doctestplus/workflows/Run%20unit%20tests/badge.svg - :target: https://github.com/astropy/pytest-doctestplus/actions - :alt: CI Status - Questions, bug reports, and feature requests can be submitted on `github`_. .. _github: https://github.com/astropy/pytest-doctestplus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/entry_points.txt new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/entry_points.txt --- old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/entry_points.txt 2021-09-20 20:02:55.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/entry_points.txt 2022-02-25 20:54:23.000000000 +0100 @@ -1,3 +1,2 @@ [pytest11] pytest_doctestplus = pytest_doctestplus.plugin - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/requires.txt new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/requires.txt --- old/pytest-doctestplus-0.11.0/pytest_doctestplus.egg-info/requires.txt 2021-09-20 20:02:55.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/pytest_doctestplus.egg-info/requires.txt 2022-02-25 20:54:24.000000000 +0100 @@ -3,5 +3,6 @@ packaging>=17.0 [test] +numpy pytest-remotedata>=0.3.2 sphinx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/setup.cfg new/pytest-doctestplus-0.12.0/setup.cfg --- old/pytest-doctestplus-0.11.0/setup.cfg 2021-09-20 20:02:55.494045000 +0200 +++ new/pytest-doctestplus-0.12.0/setup.cfg 2022-02-25 20:54:24.130348000 +0100 @@ -15,6 +15,7 @@ Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: Implementation :: CPython Topic :: Software Development :: Testing Topic :: Utilities @@ -37,6 +38,7 @@ [options.extras_require] test = + numpy pytest-remotedata>=0.3.2 sphinx diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/tests/test_doctestplus.py new/pytest-doctestplus-0.12.0/tests/test_doctestplus.py --- old/pytest-doctestplus-0.11.0/tests/test_doctestplus.py 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/tests/test_doctestplus.py 2022-02-25 20:54:11.000000000 +0100 @@ -1,6 +1,8 @@ +import glob import os -from distutils.version import LooseVersion +from packaging.version import Version from textwrap import dedent +import sys import pytest @@ -240,7 +242,7 @@ doctestplus = enabled """ ) - # These are dummy tests just to check tht doctest-plus can parse the + # These are dummy tests just to check that doctest-plus can parse the # ALLOW_BYTES and ALLOW_UNICODE options. It doesn't actually implement # these options. p = testdir.makepyfile( @@ -522,7 +524,7 @@ def test_doctest_glob(testdir): testdir.makefile( - '.rst', + '.md', foo_1=">>> 1 + 1\n2", ) testdir.makefile( @@ -530,10 +532,14 @@ foo_2=">>> 1 + 1\n2", ) testdir.makefile( - '.txt', + '.rst', foo_3=">>> 1 + 1\n2", ) testdir.makefile( + '.txt', + foo_4=">>> 1 + 1\n2", + ) + testdir.makefile( '.rst', bar_2=">>> 1 + 1\n2", ) @@ -551,29 +557,41 @@ '--doctest-plus', '--doctest-glob', '*.rst', '--doctest-glob', '*.txt' ).assertoutcome(passed=4) testdir.inline_run( + '--doctest-plus', '--doctest-glob', '*.rst', '--doctest-glob', '*.txt', + '--doctest-glob', '*.md' + ).assertoutcome(passed=5) + testdir.inline_run( '--doctest-plus', '--doctest-glob', 'foo_*.rst' ).assertoutcome(passed=2) testdir.inline_run( + '--doctest-plus', '--doctest-glob', 'foo_*.md' + ).assertoutcome(passed=1) + testdir.inline_run( '--doctest-plus', '--doctest-glob', 'foo_*.txt' ).assertoutcome(passed=1) def test_text_file_comments(testdir): testdir.makefile( + '.md', + foo_1="<!-- >>> 1 + 1 -->\n3", + ) + testdir.makefile( '.rst', - foo_1=".. >>> 1 + 1\n3", + foo_2=".. >>> 1 + 1\n3", ) testdir.makefile( '.tex', - foo_2="% >>> 1 + 1\n3", + foo_3="% >>> 1 + 1\n3", ) testdir.makefile( '.txt', - foo_3="# >>> 1 + 1\n3", + foo_4="# >>> 1 + 1\n3", ) testdir.inline_run( '--doctest-plus', + '--doctest-glob', '*.md', '--doctest-glob', '*.rst', '--doctest-glob', '*.tex', '--doctest-glob', '*.txt' @@ -635,7 +653,7 @@ ).assertoutcome(passed=2) -if LooseVersion('4.3.0') <= LooseVersion(pytest.__version__): +if Version('4.3.0') <= Version(pytest.__version__): def test_ignore_glob_option(testdir): testdir.makepyfile(foo=""" def f(): @@ -914,3 +932,108 @@ ) testdir.inline_run(p, '--doctest-plus', '--doctest-rst', '--remote-data').assertoutcome(passed=1) testdir.inline_run(p, '--doctest-plus', '--doctest-rst').assertoutcome(skipped=1) + + +def test_ufunc(testdir): + pytest.importorskip('numpy') + + # Create and build example module + testdir.makepyfile(module1=""" + def foo(): + '''A doctest... + + >>> foo() + 1 + ''' + return 1 + """) + testdir.makepyfile(module2=""" + from _module2 import foo + """) + testdir.makepyfile(setup=""" + from setuptools import setup, Extension + import numpy as np + + ext = Extension('_module2', ['_module2.c'], + extra_compile_args=['-std=c99'], + include_dirs=[np.get_include()]) + setup(name='example', py_modules=['module1', 'module2'], ext_modules=[ext]) + """) + testdir.makefile('.c', _module2=r""" + #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION + + #include <numpy/arrayobject.h> + #include <numpy/ufuncobject.h> + #include <Python.h> + + + static double foo_inner(double a, double b) + { + return a + b; + } + + + static void foo_loop( + char **args, + const npy_intp *dimensions, + const npy_intp *steps, + void *NPY_UNUSED(data) + ) { + const npy_intp n = dimensions[0]; + for (npy_intp i = 0; i < n; i ++) + { + *(double *) &args[2][i * steps[2]] = foo_inner( + *(double *) &args[0][i * steps[0]], + *(double *) &args[1][i * steps[1]]); + } + } + + + static PyUFuncGenericFunction foo_loops[] = {foo_loop}; + static char foo_types[] = {NPY_DOUBLE, NPY_DOUBLE, NPY_DOUBLE}; + static void *foo_data[] = {NULL}; + static const char foo_name[] = "foo"; + static const char foo_docstring[] = ">>> foo(1, 2)\n3.0"; + + static PyModuleDef moduledef = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_module2", + .m_size = -1 + }; + + + PyMODINIT_FUNC PyInit__module2(void) + { + import_array(); + import_ufunc(); + + PyObject *module = PyModule_Create(&moduledef); + if (!module) + return NULL; + + PyObject *obj = PyUFunc_FromFuncAndData( + foo_loops, foo_data, foo_types, 1, 2, 1, PyUFunc_None, foo_name, + foo_docstring, 0); + if (!obj) + { + Py_DECREF(module); + return NULL; + } + if (PyModule_AddObject(module, foo_name, obj) < 0) + { + Py_DECREF(obj); + Py_DECREF(module); + return NULL; + } + + return module; + } + """) + testdir.run(sys.executable, 'setup.py', 'build') + build_dir, = glob.glob(str(testdir.tmpdir / 'build/lib.*')) + + result = testdir.inline_run(build_dir, '--doctest-plus', '--doctest-modules') + result.assertoutcome(passed=1, failed=0) + + result = testdir.inline_run(build_dir, '--doctest-plus', '--doctest-modules', '--doctest-ufunc') + result.assertoutcome(passed=2, failed=0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-doctestplus-0.11.0/tox.ini new/pytest-doctestplus-0.12.0/tox.ini --- old/pytest-doctestplus-0.11.0/tox.ini 2021-09-20 20:02:37.000000000 +0200 +++ new/pytest-doctestplus-0.12.0/tox.ini 2022-02-25 20:54:11.000000000 +0100 @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39}-test + py{37,38,39,310}-test codestyle requires = setuptools >= 30.3.0 @@ -19,6 +19,7 @@ pytest60: pytest==6.0.* pytest61: pytest==6.1.* pytest62: pytest==6.2.* + pytest70: pytest==7.0.* pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest extras = @@ -27,7 +28,7 @@ commands = pip freeze # Ignore directly running tests in ``skip_some_remote_data.rst`` with - # ``remote-data`` as there are some artifical failures included in there. + # ``remote-data`` as there are some artificial failures included in there. pytest {toxinidir}/tests --ignore={toxinidir}/tests/docs/skip_some_remote_data.rst --doctest-plus --doctest-rst --remote-data {posargs} pytest {toxinidir}/tests {posargs} pytest {toxinidir}/tests --doctest-plus {posargs}