[packages/python-httpretty] - added mock patch (don't require separate mock under py3, use unittest.mock instead) - enabled test

qboosh qboosh at pld-linux.org
Sun Jun 7 10:06:32 CEST 2020


commit 8ea9bff8c04d17819fc6e8b374c9e822e578b34a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jun 7 10:07:21 2020 +0200

    - added mock patch (don't require separate mock under py3, use unittest.mock instead)
    - enabled tests by default

 python-httpretty-mock.patch | 67 +++++++++++++++++++++++++++++++++++++++++++++
 python-httpretty.spec       |  4 ++-
 2 files changed, 70 insertions(+), 1 deletion(-)
---
diff --git a/python-httpretty.spec b/python-httpretty.spec
index 94b4262..0712840 100644
--- a/python-httpretty.spec
+++ b/python-httpretty.spec
@@ -1,6 +1,6 @@
 #
 # Conditional build:
-%bcond_with	tests	# unit/functional tests
+%bcond_without	tests	# unit/functional tests
 %bcond_with	doc	# build Sphinx documentation (already built docs included in dist as of 0.9.7)
 %bcond_without	python2 # CPython 2.x module
 %bcond_without	python3 # CPython 3.x module
@@ -17,6 +17,7 @@ Group:		Libraries/Python
 #Source0Download: https://pypi.org/simple/httpretty/
 Source0:	https://files.pythonhosted.org/packages/source/h/httpretty/httpretty-%{version}.tar.gz
 # Source0-md5:	2fc3d0dc986200be95ce8ad3ef56bc04
+Patch0:		%{name}-mock.patch
 URL:		https://httpretty.readthedocs.io/
 %if %{with python2}
 BuildRequires:	python-modules >= 1:2.7
@@ -92,6 +93,7 @@ Dokumentacja API modułu Pythona httpretty.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
diff --git a/python-httpretty-mock.patch b/python-httpretty-mock.patch
new file mode 100644
index 0000000..fda09a2
--- /dev/null
+++ b/python-httpretty-mock.patch
@@ -0,0 +1,67 @@
+--- httpretty-0.9.7/setup.py.orig	2018-11-04 23:34:48.000000000 +0100
++++ httpretty-0.9.7/setup.py	2020-06-07 09:55:21.573933681 +0200
+@@ -41,7 +41,7 @@
+ 
+ 
+ install_requires = ['six']
+-tests_requires = ['nose', 'sure', 'coverage', 'mock', 'rednose']
++tests_requires = ['nose', 'sure', 'coverage', 'mock;python_version<"3.2"', 'rednose']
+ 
+ 
+ setup(
+--- httpretty-0.9.7/tests/functional/test_fakesocket.py.orig	2018-11-04 23:34:48.000000000 +0100
++++ httpretty-0.9.7/tests/functional/test_fakesocket.py	2020-06-07 09:57:25.379929633 +0200
+@@ -28,7 +28,10 @@
+ import functools
+ import socket
+ 
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ 
+ class FakeSocket(socket.socket):
+--- httpretty-0.9.7/tests/functional/test_requests.py.orig	2019-08-26 20:41:12.000000000 +0200
++++ httpretty-0.9.7/tests/functional/test_requests.py	2020-06-07 10:02:50.081503907 +0200
+@@ -816,7 +816,10 @@
+     ("HTTPretty should call a callback function *once* and set its return value"
+      " as the body of the response requests")
+ 
+-    from mock import Mock
++    try:
++        from mock import Mock
++    except ImportError:
++        from unittest.mock import Mock
+ 
+     def _request_callback(request, uri, headers):
+         return [200, headers, "The {} response from {}".format(decode_utf8(request.method), uri)]
+--- httpretty-0.9.7/tests/unit/test_core.py.orig	2019-08-26 20:41:12.000000000 +0200
++++ httpretty-0.9.7/tests/unit/test_core.py	2020-06-07 10:04:37.994252626 +0200
+@@ -5,7 +5,10 @@
+ import errno
+ from datetime import datetime
+ 
+-from mock import Mock, patch, call
++try:
++    from mock import Mock, patch, call
++except ImportError:
++    from unittest.mock import Mock, patch, call
+ from sure import expect
+ 
+ from httpretty.compat import StringIO
+--- httpretty-0.9.7/tests/unit/test_main.py.orig	2019-08-26 20:41:12.000000000 +0200
++++ httpretty-0.9.7/tests/unit/test_main.py	2020-06-07 10:05:34.600612630 +0200
+@@ -1,7 +1,10 @@
+ #!/usr/bin/env python
+ # -*- coding: utf-8 -*-
+ from __future__ import unicode_literals
+-from mock import patch
++try:
++    from mock import patch
++except ImportError:
++    from unittest.mock import patch
+ import httpretty
+ from httpretty.core import HTTPrettyRequest
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-httpretty.git/commitdiff/8ea9bff8c04d17819fc6e8b374c9e822e578b34a



More information about the pld-cvs-commit mailing list