1
0

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
This commit is contained in:
Tomáš Chvátal 2019-09-07 06:48:15 +00:00 committed by Git OBS Bridge
parent c26cf10d95
commit 86f329e46b
4 changed files with 80 additions and 3 deletions

22
merged_pr_63.patch Normal file
View File

@ -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):

46
pr_37.patch Normal file
View File

@ -0,0 +1,46 @@
commit 898d66c7eeabddf5d17bb899c8beebe5aad2c4ee
Author: Oscar Benjamin <oscar.j.benjamin@gmail.com>
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': [

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Sep 6 16:53:49 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- 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 <tchvatal@suse.com>

View File

@ -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}