From 86f329e46b4de59d89f2376c85b8feae572db664393d69920ed637cedcc460c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Sat, 7 Sep 2019 06:48:15 +0000 Subject: [PATCH] Accepting request 729013 from home:jayvdb:branches:devel:languages:python:pytest Fix breakage OBS-URL: https://build.opensuse.org/request/show/729013 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-doctestplus?expand=0&rev=9 --- merged_pr_63.patch | 22 +++++++++++++++ pr_37.patch | 46 +++++++++++++++++++++++++++++++ python-pytest-doctestplus.changes | 6 ++++ python-pytest-doctestplus.spec | 9 ++++-- 4 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 merged_pr_63.patch create mode 100644 pr_37.patch diff --git a/merged_pr_63.patch b/merged_pr_63.patch new file mode 100644 index 0000000..1dd963a --- /dev/null +++ b/merged_pr_63.patch @@ -0,0 +1,22 @@ +From 0a7176531d8395a381bf76ce8ae2e59eef1a60ea Mon Sep 17 00:00:00 2001 +From: Pey Lian Lim <2090236+pllim@users.noreply.github.com> +Date: Fri, 16 Aug 2019 14:55:38 -0400 +Subject: [PATCH] Compatibility with pytest 5.1 + +--- + pytest_doctestplus/plugin.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pytest_doctestplus/plugin.py b/pytest_doctestplus/plugin.py +index 8a830f9..20114b8 100644 +--- a/pytest_doctestplus/plugin.py ++++ b/pytest_doctestplus/plugin.py +@@ -160,7 +160,7 @@ def runtest(self): + failed, tot = doctest.testfile( + str(self.fspath), module_relative=False, + optionflags=options, parser=DocTestParserPlus(), +- extraglobs=dict(getfixture=fixture_request.getfuncargvalue), ++ extraglobs=dict(getfixture=fixture_request.getfixturevalue), + raise_on_error=True, verbose=False, encoding='utf-8') + + def reportinfo(self): diff --git a/pr_37.patch b/pr_37.patch new file mode 100644 index 0000000..64c66b0 --- /dev/null +++ b/pr_37.patch @@ -0,0 +1,46 @@ +commit 898d66c7eeabddf5d17bb899c8beebe5aad2c4ee +Author: Oscar Benjamin +Date: Thu Jan 3 17:15:04 2019 +0000 + + Inline np.allclose to remove dependency on numpy + +diff --git a/pytest_doctestplus/output_checker.py b/pytest_doctestplus/output_checker.py +index e77e2ec..b889b1c 100644 +--- a/pytest_doctestplus/output_checker.py ++++ b/pytest_doctestplus/output_checker.py +@@ -6,8 +6,7 @@ normalizations of Python expression output. See the docstring on + + import doctest + import re +- +-import numpy as np ++import math + + import six + from six.moves import zip +@@ -125,8 +124,10 @@ class OutputChecker(doctest.OutputChecker): + else: + nw_.append(nw) + +- if not np.allclose(float(ng), float(nw), rtol=self.rtol, +- atol=self.atol, equal_nan=True): ++ ng = float(ng) ++ nw = float(nw) ++ if not (abs(ng - nw) <= self.atol + self.rtol * abs(nw) ++ or (math.isnan(ng) and math.isnan(nw))): + return False + + # replace all floats in the "got" string by those from "wanted". +diff --git a/setup.py b/setup.py +index 6513c57..463f382 100755 +--- a/setup.py ++++ b/setup.py +@@ -48,7 +48,7 @@ setup( + 'Topic :: Utilities', + ], + keywords=[ 'doctest', 'rst', 'pytest', 'py.test' ], +- install_requires=[ 'six', 'pytest>=3.0', 'numpy>=1.10' ], ++ install_requires=[ 'six', 'pytest>=3.0'], + python_requires='>=2.7', + entry_points={ + 'pytest11': [ diff --git a/python-pytest-doctestplus.changes b/python-pytest-doctestplus.changes index 844fb84..2c4a2ba 100644 --- a/python-pytest-doctestplus.changes +++ b/python-pytest-doctestplus.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Sep 6 16:53:49 UTC 2019 - John Vandenberg + +- Add merged_pr_63.patch to fix incompatibility with pytest 5.1 +- Add pr_37.patch to remove numpy dependency + ------------------------------------------------------------------- Fri Mar 8 11:10:23 UTC 2019 - Tomáš Chvátal diff --git a/python-pytest-doctestplus.spec b/python-pytest-doctestplus.spec index e6cc18a..16e3a3d 100644 --- a/python-pytest-doctestplus.spec +++ b/python-pytest-doctestplus.spec @@ -33,15 +33,16 @@ License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/astropy/pytest-doctestplus Source: https://files.pythonhosted.org/packages/source/p/pytest-doctestplus/pytest-doctestplus-%{version}.tar.gz +# Backport of https://github.com/astropy/pytest-doctestplus/pull/37 +Patch0: pr_37.patch +Patch1: https://github.com/astropy/pytest-doctestplus/commit/0a7176531d8395a381bf76ce8ae2e59eef1a60ea.patch#/merged_pr_63.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-numpy >= 1.10 Requires: python-pytest >= 3.0 Requires: python-six BuildArch: noarch %if %{with test} -BuildRequires: %{python_module numpy >= 1.10} BuildRequires: %{python_module pytest >= 3.0} BuildRequires: %{python_module pytest-doctestplus >= %{version}} BuildRequires: %{python_module six} @@ -55,6 +56,7 @@ advanced doctest support and enables the testing of reStructuredText %prep %setup -q -n pytest-doctestplus-%{version} +%autopatch -p1 # do not change the pytest behaviour for us rm -f setup.cfg @@ -70,7 +72,8 @@ rm -f setup.cfg %if %{with test} %check export LANG=en_US.UTF8 -%python_expand PYTHONPATH=%{$python_sitelib} py.test-%{$python_bin_suffix} tests/ --doctest-plus --doctest-rst +# README.rst contains Python 3 only imports +%pytest --doctest-plus --doctest-rst -k 'not README.rst' %endif %if !%{with test}