[packages/python-sure] - updated to 1.4.11 - added mock patch (use unittest.mock instead of separate mock under py3)

qboosh qboosh at pld-linux.org
Sat Jun 6 09:03:58 CEST 2020


commit efd08cc32888daf9f27ac033fa1811ccde3f2436
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat Jun 6 09:04:31 2020 +0200

    - updated to 1.4.11
    - added mock patch (use unittest.mock instead of separate mock under py3)

 python-sure-mock.patch | 65 +++++++++++++++++++++++++++++++++++++++++++++++++
 python-sure.spec       | 66 ++++++++++++++++++++++++++++----------------------
 2 files changed, 102 insertions(+), 29 deletions(-)
---
diff --git a/python-sure.spec b/python-sure.spec
index 45ece8a..93fc022 100644
--- a/python-sure.spec
+++ b/python-sure.spec
@@ -1,57 +1,66 @@
 #
 # Conditional build:
-%bcond_without	tests	# do not perform "make test"
+%bcond_without	tests	# unit tests
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
 
 %define		module		sure
-%define		egg_name	sure
-%define		pypi_name	sure
 Summary:	Utility belt for automated testing in Python for Python
+Summary(pl.UTF-8):	Narzędzia do automatycznego testowania w Pythonie
 Name:		python-%{module}
-Version:	1.2.24
-Release:	4
+Version:	1.4.11
+Release:	1
 License:	GPL v3+
 Group:		Libraries/Python
-Source0:	https://pypi.python.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
-# Source0-md5:	a396cc3c71d551bfdb9bc45363ca05da
+#Source0Download; https://pypi.org/simple/sure/
+Source0:	https://files.pythonhosted.org/packages/source/s/sure/%{module}-%{version}.tar.gz
+# Source0-md5:	51f28b4ea7a6f59d1dd09f8eaaeabee7
+Patch0:		%{name}-mock.patch
 URL:		https://github.com/gabrielfalcao/sure
-BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.710
 %if %{with python2}
-BuildRequires:	python-devel
-BuildRequires:	python-distribute
-BuildRequires:	python-mock
+BuildRequires:	python-devel >= 1:2.7
+BuildRequires:	python-mock >= 2.0.0
 BuildRequires:	python-nose
-BuildRequires:	python-six
+BuildRequires:	python-setuptools
+BuildRequires:	python-six >= 1.10.0
 %endif
 %if %{with python3}
-BuildRequires:	python3-devel
-BuildRequires:	python3-distribute
-BuildRequires:	python3-mock
-BuildRequires:	python3-modules
+BuildRequires:	python3-devel >= 1:3.4
 BuildRequires:	python3-nose
-BuildRequires:	python3-six
+BuildRequires:	python3-setuptools
+BuildRequires:	python3-six >= 1.10.0
 %endif
-Requires:	python-modules
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
-A testing library for python with powerful and flexible assertions.
+A testing library for Python with powerful and flexible assertions.
 Sure is heavily inspired by should.js.
 
+%description -l pl.UTF-8
+Biblioteka testów dla Pythona z bardzo elastycznymi asercjami. Sure
+jest znacząco zainspirowany should.js.
+
 %package -n python3-%{module}
 Summary:	Utility belt for automated testing in python for python
+Summary(pl.UTF-8):	Narzędzia do automatycznego testowania w Pythonie
 Group:		Libraries/Python
-Requires:	python3-modules
+Requires:	python3-modules >= 1:3.4
 
 %description -n python3-%{module}
-A testing library for python with powerful and flexible assertions.
+A testing library for Python with powerful and flexible assertions.
 Sure is heavily inspired by should.js.
 
+%description -n python3-%{module} -l pl.UTF-8
+Biblioteka testów dla Pythona z bardzo elastycznymi asercjami. Sure
+jest znacząco zainspirowany should.js.
+
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
@@ -81,16 +90,15 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc README.md
-%dir %{py_sitescriptdir}/%{module}
-%{py_sitescriptdir}/%{module}/*.py[co]
-%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
+%doc README.rst
+%{py_sitescriptdir}/sure
+%{py_sitescriptdir}/sure-%{version}-py*.egg-info
 %endif
 
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
-%doc  README.md
-%{py3_sitescriptdir}/%{module}
-%{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
+%doc README.rst
+%{py3_sitescriptdir}/sure
+%{py3_sitescriptdir}/sure-%{version}-py*.egg-info
 %endif
diff --git a/python-sure-mock.patch b/python-sure-mock.patch
new file mode 100644
index 0000000..cf6a260
--- /dev/null
+++ b/python-sure-mock.patch
@@ -0,0 +1,65 @@
+--- sure-1.4.11/setup.py.orig	2018-05-16 23:37:56.000000000 +0200
++++ sure-1.4.11/setup.py	2020-06-06 07:54:38.467908573 +0200
+@@ -58,7 +58,7 @@
+         return __doc__
+ 
+ 
+-install_requires = ['mock', 'six']
++install_requires = ['mock;python_version<"3"', 'six']
+ tests_require = ['nose']
+ 
+ 
+--- sure-1.4.11/sure/core.py.orig	2018-03-17 23:31:48.000000000 +0100
++++ sure-1.4.11/sure/core.py	2020-06-06 07:56:27.183986275 +0200
+@@ -19,9 +19,12 @@
+ import os
+ 
+ try:
+-    from mock import _CallList
++    from unittest.mock import _CallList
+ except ImportError:
+-    from mock.mock import _CallList
++    try:
++        from mock import _CallList
++    except ImportError:
++        from mock.mock import _CallList
+ 
+ import inspect
+ from six import (
+--- sure-1.4.11/tests/test_assertion_builder.py.orig	2017-03-20 14:51:42.000000000 +0100
++++ sure-1.4.11/tests/test_assertion_builder.py	2020-06-06 07:58:55.016518731 +0200
+@@ -17,7 +17,10 @@
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ from __future__ import unicode_literals
+ import re
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ from collections import OrderedDict
+ 
+ from datetime import datetime, timedelta
+@@ -654,18 +654,18 @@
+ 
+     except AssertionError as e:
+         if PY2:
+-            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 635]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
++            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 638]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
+         else:
+-            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 635]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
++            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 638]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
+ 
+     try:
+         expect(blah).when.called_with(1).should.throw(ValueError, re.compile(r'invalid regex'))
+         raise RuntimeError('should not have reached here')
+     except AssertionError as e:
+         if PY2:
+-            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 635]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
++            expect(str(e)).to.equal("When calling 'blah [tests/test_assertion_builder.py line 638]' the exception message does not match. Expected to match regex: u'invalid regex'\n against:\n u'this message'")
+         else:
+-            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 635]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
++            expect(str(e)).to.equal("When calling b'blah [tests/test_assertion_builder.py line 638]' the exception message does not match. Expected to match regex: 'invalid regex'\n against:\n 'this message'")
+ 
+ def test_should_not_be_different():
+     ("'something'.should_not.be.different('SOMETHING'.lower())")
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-sure.git/commitdiff/efd08cc32888daf9f27ac033fa1811ccde3f2436



More information about the pld-cvs-commit mailing list