Hello community,
here is the log from the commit of package python-responses for
openSUSE:Factory checked in at 2019-05-17 23:38:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-responses (Old)
and /work/SRC/openSUSE:Factory/.python-responses.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-responses"
Fri May 17 23:38:20 2019 rev:8 rq:702856 version:0.10.6
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-responses/python-responses.changes
2019-02-11 21:26:05.243057884 +0100
+++
/work/SRC/openSUSE:Factory/.python-responses.new.5148/python-responses.changes
2019-05-17 23:38:21.506071164 +0200
@@ -1,0 +2,9 @@
+Tue May 14 14:13:30 UTC 2019 - Ondřej Súkup <[email protected]>
+
+- update to 0.10.6
+- drop tidy-py_modules.patch
+- use %pytest macro
+ * ConnectionError's raised by responses now indicate which request
+ path/method failed to match a mock.
+
+-------------------------------------------------------------------
Old:
----
responses-0.10.5.tar.gz
tidy-py_modules.patch
New:
----
responses-0.10.6.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-responses.spec ++++++
--- /var/tmp/diff_new_pack.2bK6qT/_old 2019-05-17 23:38:22.082070847 +0200
+++ /var/tmp/diff_new_pack.2bK6qT/_new 2019-05-17 23:38:22.086070845 +0200
@@ -18,14 +18,13 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-responses
-Version: 0.10.5
+Version: 0.10.6
Release: 0
Summary: A utility library for mocking out the `requests` Python library
License: Apache-2.0
Group: Development/Languages/Python
Url: https://github.com/getsentry/responses
Source:
https://files.pythonhosted.org/packages/source/r/responses/responses-%{version}.tar.gz
-Patch: tidy-py_modules.patch
BuildRequires: %{python_module setuptools}
# test requirements
BuildRequires: %{python_module cookies}
@@ -35,13 +34,13 @@
BuildRequires: %{python_module requests >= 2.0}
BuildRequires: %{python_module six}
BuildRequires: python-rpm-macros
-Requires: python-cookies
Requires: python-requests >= 2.0
Requires: python-six
Suggests: python-pytest
BuildArch: noarch
%ifpython2
-Requires: python-mock
+Requires: python2-cookies
+Requires: python2-mock
%endif
%python_subpackages
@@ -52,9 +51,6 @@
%prep
%setup -q -n responses-%{version}
-# Remove test module from distribution before a .pyc is created
-# https://github.com/getsentry/responses/issues/256
-%patch -p0
%build
%python_build
@@ -63,8 +59,7 @@
%python_install
%check
-# `setup.py test` requires additional unnecessary packages
-%python_exec -m pytest
+%pytest
%files %{python_files}
%doc CHANGES README.rst
++++++ responses-0.10.5.tar.gz -> responses-0.10.6.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/CHANGES new/responses-0.10.6/CHANGES
--- old/responses-0.10.5/CHANGES 2018-12-17 20:42:05.000000000 +0100
+++ new/responses-0.10.6/CHANGES 2019-03-15 17:00:18.000000000 +0100
@@ -1,3 +1,18 @@
+0.10.6
+------
+
+- Improved documentation.
+- Improved installation requirements for py3
+- ConnectionError's raised by responses now indicate which request
+ path/method failed to match a mock.
+- `test_responses.py` is no longer part of the installation targets.
+
+0.10.5
+------
+
+- Improved support for raising exceptions from callback mocks. If a mock
+ callback returns an exception object that exception will be raised.
+
0.10.4
------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/MANIFEST.in
new/responses-0.10.6/MANIFEST.in
--- old/responses-0.10.5/MANIFEST.in 2018-12-17 20:42:05.000000000 +0100
+++ new/responses-0.10.6/MANIFEST.in 2019-03-15 17:00:18.000000000 +0100
@@ -1,2 +1,3 @@
include README.rst CHANGES LICENSE
+include test_responses.py tox.ini
global-exclude *~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/PKG-INFO
new/responses-0.10.6/PKG-INFO
--- old/responses-0.10.5/PKG-INFO 2018-12-17 20:42:55.000000000 +0100
+++ new/responses-0.10.6/PKG-INFO 2019-03-15 17:01:04.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: responses
-Version: 0.10.5
+Version: 0.10.6
Summary: A utility library for mocking out the `requests` Python library.
Home-page: https://github.com/getsentry/responses
Author: David Cramer
@@ -91,7 +91,7 @@
responses.Response(
method='GET',
url='http://example.com',
- ),
+ )
)
The following attributes can be passed to a Response mock:
@@ -171,6 +171,53 @@
'728d329e-0e86-11e4-a748-0c84dc037c13'
)
+ You can also pass a compiled regex to `add_callback` to match multiple
urls:
+
+ .. code-block:: python
+
+ import re, json
+
+ from functools import reduce
+
+ import responses
+ import requests
+
+ operators = {
+ 'sum': lambda x, y: x+y,
+ 'prod': lambda x, y: x*y,
+ 'pow': lambda x, y: x**y
+ }
+
+ @responses.activate
+ def test_regex_url():
+
+ def request_callback(request):
+ payload = json.loads(request.body)
+ operator_name = request.path_url[1:]
+
+ operator = operators[operator_name]
+
+ resp_body = {'value': reduce(operator, payload['numbers'])}
+ headers = {'request-id':
'728d329e-0e86-11e4-a748-0c84dc037c13'}
+ return (200, headers, json.dumps(resp_body))
+
+ responses.add_callback(
+ responses.POST,
+ re.compile('http://calc.com/(sum|prod|pow|unsupported)'),
+ callback=request_callback,
+ content_type='application/json',
+ )
+
+ resp = requests.post(
+ 'http://calc.com/prod',
+ json.dumps({'numbers': [2, 3, 4]}),
+ headers={'content-type': 'application/json'},
+ )
+ assert resp.json() == {'value': 24}
+
+ test_regex_url()
+
+
If you want to pass extra keyword arguments to the callback function,
for example when reusing
a callback function to give a slightly different result, you can use
``functools.partial``:
@@ -320,6 +367,40 @@
as a mock response, to passthru using the standard behavior.
+ Viewing/Modifying registered responses
+ --------------------------------------
+
+ Registered responses are available as a private attribute of the
RequestMock
+ instance. It is sometimes useful for debugging purposes to view the
stack of
+ registered responses which can be accessed via
``responses.mock._matches``.
+
+ The ``replace`` function allows a previously registered ``response``
to be
+ changed. The method signature is identical to ``add``. ``response``s
are
+ identified using ``method`` and ``url``. Only the first matched
``response`` is
+ replaced.
+
+ .. code-block:: python
+
+ import responses
+ import requests
+
+ @responses.activate
+ def test_replace():
+
+ responses.add(responses.GET, 'http://example.org',
json={'data': 1})
+ responses.replace(responses.GET, 'http://example.org',
json={'data': 2})
+
+ resp = requests.get('http://example.org')
+
+ assert resp.json() == {'data': 2}
+
+
+ ``remove`` takes a ``method`` and ``url`` argument and will remove
*all*
+ matched ``response``s from the registered list.
+
+ Finally, ``clear`` will reset all registered ``response``s
+
+
Contributing
------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/README.rst
new/responses-0.10.6/README.rst
--- old/responses-0.10.5/README.rst 2018-12-17 20:42:05.000000000 +0100
+++ new/responses-0.10.6/README.rst 2019-03-15 17:00:18.000000000 +0100
@@ -84,7 +84,7 @@
responses.Response(
method='GET',
url='http://example.com',
- ),
+ )
)
The following attributes can be passed to a Response mock:
@@ -164,6 +164,53 @@
'728d329e-0e86-11e4-a748-0c84dc037c13'
)
+You can also pass a compiled regex to `add_callback` to match multiple urls:
+
+.. code-block:: python
+
+ import re, json
+
+ from functools import reduce
+
+ import responses
+ import requests
+
+ operators = {
+ 'sum': lambda x, y: x+y,
+ 'prod': lambda x, y: x*y,
+ 'pow': lambda x, y: x**y
+ }
+
+ @responses.activate
+ def test_regex_url():
+
+ def request_callback(request):
+ payload = json.loads(request.body)
+ operator_name = request.path_url[1:]
+
+ operator = operators[operator_name]
+
+ resp_body = {'value': reduce(operator, payload['numbers'])}
+ headers = {'request-id': '728d329e-0e86-11e4-a748-0c84dc037c13'}
+ return (200, headers, json.dumps(resp_body))
+
+ responses.add_callback(
+ responses.POST,
+ re.compile('http://calc.com/(sum|prod|pow|unsupported)'),
+ callback=request_callback,
+ content_type='application/json',
+ )
+
+ resp = requests.post(
+ 'http://calc.com/prod',
+ json.dumps({'numbers': [2, 3, 4]}),
+ headers={'content-type': 'application/json'},
+ )
+ assert resp.json() == {'value': 24}
+
+ test_regex_url()
+
+
If you want to pass extra keyword arguments to the callback function, for
example when reusing
a callback function to give a slightly different result, you can use
``functools.partial``:
@@ -313,6 +360,40 @@
as a mock response, to passthru using the standard behavior.
+Viewing/Modifying registered responses
+--------------------------------------
+
+Registered responses are available as a private attribute of the RequestMock
+instance. It is sometimes useful for debugging purposes to view the stack of
+registered responses which can be accessed via ``responses.mock._matches``.
+
+The ``replace`` function allows a previously registered ``response`` to be
+changed. The method signature is identical to ``add``. ``response``s are
+identified using ``method`` and ``url``. Only the first matched ``response`` is
+replaced.
+
+.. code-block:: python
+
+ import responses
+ import requests
+
+ @responses.activate
+ def test_replace():
+
+ responses.add(responses.GET, 'http://example.org', json={'data': 1})
+ responses.replace(responses.GET, 'http://example.org', json={'data':
2})
+
+ resp = requests.get('http://example.org')
+
+ assert resp.json() == {'data': 2}
+
+
+``remove`` takes a ``method`` and ``url`` argument and will remove *all*
+matched ``response``s from the registered list.
+
+Finally, ``clear`` will reset all registered ``response``s
+
+
Contributing
------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/responses.egg-info/PKG-INFO
new/responses-0.10.6/responses.egg-info/PKG-INFO
--- old/responses-0.10.5/responses.egg-info/PKG-INFO 2018-12-17
20:42:54.000000000 +0100
+++ new/responses-0.10.6/responses.egg-info/PKG-INFO 2019-03-15
17:01:04.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: responses
-Version: 0.10.5
+Version: 0.10.6
Summary: A utility library for mocking out the `requests` Python library.
Home-page: https://github.com/getsentry/responses
Author: David Cramer
@@ -91,7 +91,7 @@
responses.Response(
method='GET',
url='http://example.com',
- ),
+ )
)
The following attributes can be passed to a Response mock:
@@ -171,6 +171,53 @@
'728d329e-0e86-11e4-a748-0c84dc037c13'
)
+ You can also pass a compiled regex to `add_callback` to match multiple
urls:
+
+ .. code-block:: python
+
+ import re, json
+
+ from functools import reduce
+
+ import responses
+ import requests
+
+ operators = {
+ 'sum': lambda x, y: x+y,
+ 'prod': lambda x, y: x*y,
+ 'pow': lambda x, y: x**y
+ }
+
+ @responses.activate
+ def test_regex_url():
+
+ def request_callback(request):
+ payload = json.loads(request.body)
+ operator_name = request.path_url[1:]
+
+ operator = operators[operator_name]
+
+ resp_body = {'value': reduce(operator, payload['numbers'])}
+ headers = {'request-id':
'728d329e-0e86-11e4-a748-0c84dc037c13'}
+ return (200, headers, json.dumps(resp_body))
+
+ responses.add_callback(
+ responses.POST,
+ re.compile('http://calc.com/(sum|prod|pow|unsupported)'),
+ callback=request_callback,
+ content_type='application/json',
+ )
+
+ resp = requests.post(
+ 'http://calc.com/prod',
+ json.dumps({'numbers': [2, 3, 4]}),
+ headers={'content-type': 'application/json'},
+ )
+ assert resp.json() == {'value': 24}
+
+ test_regex_url()
+
+
If you want to pass extra keyword arguments to the callback function,
for example when reusing
a callback function to give a slightly different result, you can use
``functools.partial``:
@@ -320,6 +367,40 @@
as a mock response, to passthru using the standard behavior.
+ Viewing/Modifying registered responses
+ --------------------------------------
+
+ Registered responses are available as a private attribute of the
RequestMock
+ instance. It is sometimes useful for debugging purposes to view the
stack of
+ registered responses which can be accessed via
``responses.mock._matches``.
+
+ The ``replace`` function allows a previously registered ``response``
to be
+ changed. The method signature is identical to ``add``. ``response``s
are
+ identified using ``method`` and ``url``. Only the first matched
``response`` is
+ replaced.
+
+ .. code-block:: python
+
+ import responses
+ import requests
+
+ @responses.activate
+ def test_replace():
+
+ responses.add(responses.GET, 'http://example.org',
json={'data': 1})
+ responses.replace(responses.GET, 'http://example.org',
json={'data': 2})
+
+ resp = requests.get('http://example.org')
+
+ assert resp.json() == {'data': 2}
+
+
+ ``remove`` takes a ``method`` and ``url`` argument and will remove
*all*
+ matched ``response``s from the registered list.
+
+ Finally, ``clear`` will reset all registered ``response``s
+
+
Contributing
------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/responses.egg-info/SOURCES.txt
new/responses-0.10.6/responses.egg-info/SOURCES.txt
--- old/responses-0.10.5/responses.egg-info/SOURCES.txt 2018-12-17
20:42:54.000000000 +0100
+++ new/responses-0.10.6/responses.egg-info/SOURCES.txt 2019-03-15
17:01:04.000000000 +0100
@@ -6,6 +6,7 @@
setup.cfg
setup.py
test_responses.py
+tox.ini
responses.egg-info/PKG-INFO
responses.egg-info/SOURCES.txt
responses.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/responses.egg-info/requires.txt
new/responses-0.10.6/responses.egg-info/requires.txt
--- old/responses-0.10.5/responses.egg-info/requires.txt 2018-12-17
20:42:54.000000000 +0100
+++ new/responses-0.10.6/responses.egg-info/requires.txt 2019-03-15
17:01:04.000000000 +0100
@@ -1,12 +1,12 @@
requests>=2.0
six
+[:python_version < "3.3"]
+mock
+
[:python_version < "3.4"]
cookies
-[:python_version in "2.6, 2.7, 3.2"]
-mock
-
[tests]
pytest
coverage<5.0.0,>=3.7.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/responses.egg-info/top_level.txt
new/responses-0.10.6/responses.egg-info/top_level.txt
--- old/responses-0.10.5/responses.egg-info/top_level.txt 2018-12-17
20:42:54.000000000 +0100
+++ new/responses-0.10.6/responses.egg-info/top_level.txt 2019-03-15
17:01:04.000000000 +0100
@@ -1,2 +1 @@
responses
-test_responses
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/responses.py
new/responses-0.10.6/responses.py
--- old/responses-0.10.5/responses.py 2018-12-17 20:42:05.000000000 +0100
+++ new/responses-0.10.6/responses.py 2019-03-15 17:00:18.000000000 +0100
@@ -589,8 +589,9 @@
logger.info("request.allowed-passthru", extra={"url":
request.url})
return _real_send(adapter, request, **kwargs)
- error_msg = "Connection refused: {0} {1}".format(
- request.method, request.url
+ error_msg = (
+ "Connection refused by Responses: {0} {1} doesn't "
+ "match Responses Mock".format(request.method, request.url)
)
response = ConnectionError(error_msg)
response.request = request
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/setup.py
new/responses-0.10.6/setup.py
--- old/responses-0.10.5/setup.py 2018-12-17 20:42:05.000000000 +0100
+++ new/responses-0.10.6/setup.py 2019-03-15 17:00:18.000000000 +0100
@@ -10,18 +10,21 @@
"""
import sys
-import logging
from setuptools import setup
from setuptools.command.test import test as TestCommand
-import pkg_resources
setup_requires = []
if "test" in sys.argv:
setup_requires.append("pytest")
-install_requires = ["requests>=2.0", "cookies;python_version<'3.4'", "six"]
+install_requires = [
+ "cookies; python_version < '3.4'",
+ "mock; python_version < '3.3'",
+ "requests>=2.0",
+ "six",
+]
tests_require = [
"pytest",
@@ -31,24 +34,7 @@
"flake8",
]
-extras_require = {
- ':python_version in "2.6, 2.7, 3.2"': ["mock"],
- "tests": tests_require,
-}
-
-try:
- if "bdist_wheel" not in sys.argv:
- for key, value in extras_require.items():
- if key.startswith(":") and pkg_resources.evaluate_marker(key[1:]):
- install_requires.extend(value)
-except Exception:
- logging.getLogger(__name__).exception(
- "Something went wrong calculating platform specific dependencies, so "
- "you're getting them all!"
- )
- for key, value in extras_require.items():
- if key.startswith(":"):
- install_requires.extend(value)
+extras_require = {"tests": tests_require}
class PyTest(TestCommand):
@@ -67,13 +53,13 @@
setup(
name="responses",
- version="0.10.5",
+ version="0.10.6",
author="David Cramer",
description=("A utility library for mocking out the `requests` Python
library."),
url="https://github.com/getsentry/responses",
license="Apache 2.0",
long_description=open("README.rst").read(),
- py_modules=["responses", "test_responses"],
+ py_modules=["responses"],
zip_safe=False,
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
install_requires=install_requires,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/responses-0.10.5/tox.ini new/responses-0.10.6/tox.ini
--- old/responses-0.10.5/tox.ini 1970-01-01 01:00:00.000000000 +0100
+++ new/responses-0.10.6/tox.ini 2019-03-15 17:00:18.000000000 +0100
@@ -0,0 +1,7 @@
+[tox]
+envlist = py27,py34,py35,py36,py37
+
+[testenv]
+extras = tests
+commands =
+ pytest . --cov responses --cov-report term-missing