Hello community,
here is the log from the commit of package python-requests-mock for
openSUSE:Factory checked in at 2019-05-09 14:27:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests-mock (Old)
and /work/SRC/openSUSE:Factory/.python-requests-mock.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests-mock"
Thu May 9 14:27:39 2019 rev:11 rq:701328 version:1.6.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-requests-mock/python-requests-mock.changes
2019-03-12 09:44:53.619746108 +0100
+++
/work/SRC/openSUSE:Factory/.python-requests-mock.new.5148/python-requests-mock.changes
2019-05-09 14:27:40.541837102 +0200
@@ -1,0 +2,10 @@
+Tue May 7 13:19:56 UTC 2019 - [email protected]
+
+- version update to 1.6.0
+ * Respect user provided content encoding type
+ * Update minimum requests version to 2.3
+ * Add testing for Python 3.7 & PyPy3
+ * Drop \_matcher from request pickled state
+ * Clarify the pytest configuration documentation
+
+-------------------------------------------------------------------
Old:
----
requests-mock-1.5.2.tar.gz
New:
----
requests-mock-1.6.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-requests-mock.spec ++++++
--- /var/tmp/diff_new_pack.xrzsQH/_old 2019-05-09 14:27:41.085838361 +0200
+++ /var/tmp/diff_new_pack.xrzsQH/_new 2019-05-09 14:27:41.089838370 +0200
@@ -17,9 +17,8 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-%bcond_without test
Name: python-requests-mock
-Version: 1.5.2
+Version: 1.6.0
Release: 0
Summary: Mock out responses from the requests package
License: Apache-2.0
@@ -36,7 +35,7 @@
BuildRequires: %{python_module testrepository >= 0.0.18}
BuildRequires: %{python_module testtools}
BuildRequires: fdupes
-Requires: python-requests >= 1.1
+Requires: python-requests >= 2.3
Requires: python-six
BuildArch: noarch
%ifpython3
@@ -59,16 +58,16 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}/mymodule
-%if %{with test}
%check
mv .testr.conf .testr.conf.orig
+# purl optional dependency is missing at time of writing (2019-05-07)
+rm ./tests/test_adapter.py
%{python_expand # first line can't be empty
rm -rf .testrepository
sed 's/python/$python/' .testr.conf.orig >| .testr.conf
testr init
testr run --parallel
}
-%endif
%files %{python_files}
%license LICENSE
++++++ requests-mock-1.5.2.tar.gz -> requests-mock-1.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/.circleci/config.yml
new/requests-mock-1.6.0/.circleci/config.yml
--- old/requests-mock-1.5.2/.circleci/config.yml 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/.circleci/config.yml 2019-04-28
11:13:46.000000000 +0200
@@ -62,6 +62,37 @@
source venv/bin/activate
tox -e py27
+ oldest:
+ docker:
+ - image: circleci/python:3.6
+
+ steps:
+ - checkout
+
+ - restore_cache:
+ keys:
+ - oldest-dependencies-{{ checksum "requirements.txt" }}-{{
checksum "test-requirements.txt" }}
+
+ - run:
+ name: install dependencies
+ command: |
+ python3 -m venv venv
+ source venv/bin/activate
+ pip3 install tox
+ tox -e oldest-requirements --notest
+
+ - save_cache:
+ paths:
+ - ./venv
+ - .tox/py36
+ key: oldest-dependencies-{{ checksum "requirements.txt" }}-{{
checksum "test-requirements.txt" }}
+
+ - run:
+ name: run tests
+ command: |
+ source venv/bin/activate
+ tox -e py36
+
pypi:
docker:
- image: circleci/python:3.6
@@ -92,10 +123,16 @@
tags:
only: /^\d+\.\d+\.\d+$/
+ - oldest:
+ filters:
+ tags:
+ only: /^\d+\.\d+\.\d+$/
+
- pypi:
requires:
- py27
- py36
+ - oldest
filters:
branches:
ignore: /.*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/.tox.oldest.txt
new/requests-mock-1.6.0/.tox.oldest.txt
--- old/requests-mock-1.5.2/.tox.oldest.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/requests-mock-1.6.0/.tox.oldest.txt 2019-04-28 11:13:46.000000000
+0200
@@ -0,0 +1 @@
+requests==2.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/AUTHORS
new/requests-mock-1.6.0/AUTHORS
--- old/requests-mock-1.5.2/AUTHORS 2018-07-21 05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/AUTHORS 2019-04-28 11:14:07.000000000 +0200
@@ -11,10 +11,11 @@
Louis Taylor <[email protected]>
Manuel Kaufmann <[email protected]>
Monty Taylor <[email protected]>
+Noam <[email protected]>
Rick van de Loo <[email protected]>
Sebastian Kalinowski <[email protected]>
Swapnil Kulkarni (coolsvap) <[email protected]>
Ville Skyttä <[email protected]>
-Zuul <[email protected]>
+boncheff <[email protected]>
reedip <[email protected]>
voith <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/ChangeLog
new/requests-mock-1.6.0/ChangeLog
--- old/requests-mock-1.5.2/ChangeLog 2018-07-21 05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/ChangeLog 2019-04-28 11:14:07.000000000 +0200
@@ -1,6 +1,18 @@
CHANGES
=======
+1.6.0
+-----
+
+* Fix PEP8 failure in test\_adapter
+* Respect user provided content encoding type
+* Update minimum requests version to 2.3
+* Added support for purl
+* Add testing for Python 3.7 & PyPy3
+* Drop \_matcher from request pickled state
+* Clarify the pytest configuration documentation
+* Update mocker.rst
+
1.5.2
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/PKG-INFO
new/requests-mock-1.6.0/PKG-INFO
--- old/requests-mock-1.5.2/PKG-INFO 2018-07-21 05:58:11.000000000 +0200
+++ new/requests-mock-1.6.0/PKG-INFO 2019-04-28 11:14:08.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: requests-mock
-Version: 1.5.2
+Version: 1.6.0
Summary: Mock out responses from the requests package
Home-page: https://requests-mock.readthedocs.io/
Author: Jamie Lennox
@@ -110,6 +110,7 @@
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/RELEASENOTES.rst
new/requests-mock-1.6.0/RELEASENOTES.rst
--- old/requests-mock-1.5.2/RELEASENOTES.rst 2018-07-21 05:58:11.000000000
+0200
+++ new/requests-mock-1.6.0/RELEASENOTES.rst 2019-04-28 11:14:08.000000000
+0200
@@ -2,6 +2,52 @@
requests-mock
=============
+.. _requests-mock_1.6.0:
+
+1.6.0
+=====
+
+.. _requests-mock_1.6.0_Prelude:
+
+Prelude
+-------
+
+.. releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml @
b'3a7c98f63d625f675c36df27724148fbe75f50a6'
+
+Increase the minimum required requests version to 2.3
+
+
+.. _requests-mock_1.6.0_Critical Issues:
+
+Critical Issues
+---------------
+
+.. releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml @
b'3a7c98f63d625f675c36df27724148fbe75f50a6'
+
+- The minimum version of requests has been increase to 2.3. This simply
+ ensures that all documented features of requests-mock are actually
+ available. This version of requests is still quite old and if this is an
+ issue you should either pin requests-mock to <1.6 or preferably update
+ requests.
+
+
+.. _requests-mock_1.6.0_Bug Fixes:
+
+Bug Fixes
+---------
+
+.. releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml @
b'a0e8fb61e0bcadb85b0dcb1ea3b7a5d029821ee8'
+
+- Remove weakref objects from the request/response that will allow the objects
to be pickled with the regular python mechanisms.
+
+.. releasenotes/notes/user-response-encoding-b2eea39404140164.yaml @
b'f4f3b0a631a76b73bc08757a6b78055e5a7d6835'
+
+- If you specified a charset in the Content-Type of a response it would be
+ ignored and overriden with either 'utf-8' or None depending on the type of
+ response content passed in. If you pass this value we should honour it and
+ perform the encoding correctly.
+
+
.. _requests-mock_1.5.2:
1.5.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/doc/source/mocker.rst
new/requests-mock-1.6.0/doc/source/mocker.rst
--- old/requests-mock-1.5.2/doc/source/mocker.rst 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/doc/source/mocker.rst 2019-04-28
11:13:46.000000000 +0200
@@ -3,7 +3,7 @@
================
The mocker is a loading mechanism to ensure the adapter is correctly in place
to intercept calls from requests.
-It's goal is to provide an interface that is as close to the real requests
library interface as possible.
+Its goal is to provide an interface that is as close to the real requests
library interface as possible.
Activation
==========
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/doc/source/pytest.rst
new/requests-mock-1.6.0/doc/source/pytest.rst
--- old/requests-mock-1.5.2/doc/source/pytest.rst 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/doc/source/pytest.rst 2019-04-28
11:13:46.000000000 +0200
@@ -19,3 +19,12 @@
...
.. _pytest: https://pytest.org
+
+Configuration
+=============
+
+Some options are available to be read from pytest's configuration mechanism.
+
+These options are:
+
+ `requests_mock_case_sensitive`: (bool) Turn on case sensitivity in path
matching.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-mock-1.5.2/releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
new/requests-mock-1.6.0/releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
---
old/requests-mock-1.5.2/releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
1970-01-01 01:00:00.000000000 +0100
+++
new/requests-mock-1.6.0/releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
2019-04-28 11:13:46.000000000 +0200
@@ -0,0 +1,4 @@
+---
+fixes:
+ - Remove weakref objects from the request/response that will allow the
+ objects to be pickled with the regular python mechanisms. #78
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-mock-1.5.2/releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
new/requests-mock-1.6.0/releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
---
old/requests-mock-1.5.2/releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
1970-01-01 01:00:00.000000000 +0100
+++
new/requests-mock-1.6.0/releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
2019-04-28 11:13:46.000000000 +0200
@@ -0,0 +1,10 @@
+---
+prelude: >
+ Increase the minimum required requests version to 2.3
+critical:
+ - |
+ The minimum version of requests has been increase to 2.3. This simply
+ ensures that all documented features of requests-mock are actually
+ available. This version of requests is still quite old and if this is an
+ issue you should either pin requests-mock to <1.6 or preferably update
+ requests.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/releasenotes/notes/reno.cache
new/requests-mock-1.6.0/releasenotes/notes/reno.cache
--- old/requests-mock-1.5.2/releasenotes/notes/reno.cache 2018-07-21
05:58:11.000000000 +0200
+++ new/requests-mock-1.6.0/releasenotes/notes/reno.cache 2019-04-28
11:14:08.000000000 +0200
@@ -1,69 +1,122 @@
---
file-contents:
releasenotes/notes/Add-called_once-property-a69546448cbd5542.yaml:
- features: [A called_once property was added to the adapter and the mocker.
This
- gives us an easy way to emulate mock's assert_called_once.]
+ features:
+ - A called_once property was added to the adapter and the mocker. This
gives us
+ an easy way to emulate mock's assert_called_once.
prelude: 'Add a called_once property to the mockers.
'
+ releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml:
+ fixes:
+ - Remove weakref objects from the request/response that will allow the
objects
+ to be pickled with the regular python mechanisms.
+ releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml:
+ critical:
+ - 'The minimum version of requests has been increase to 2.3. This simply
+
+ ensures that all documented features of requests-mock are actually
+
+ available. This version of requests is still quite old and if this is an
+
+ issue you should either pin requests-mock to <1.6 or preferably update
+
+ requests.
+
+ '
+ prelude: 'Increase the minimum required requests version to 2.3
+
+ '
releasenotes/notes/additional-matcher-5c5cd466a6d70080.yaml:
- features: [Allow specifying an `additional_matcher` to the mocker that
will call
- a function to allow a user to add their own custom request matching
logic.]
+ features:
+ - Allow specifying an `additional_matcher` to the mocker that will call a
function
+ to allow a user to add their own custom request matching logic.
releasenotes/notes/case-insensitive-matching-a3143221359bbf2d.yaml:
- features: [You can pass case_sensitive=True to an adapter or set
`requests_mock.mock.case_sensitive
- = True` globally to enable case sensitive matching.]
- fixes: ['Reported in bug \#1584008 all request matching is done in a case
insensitive
- way, as a byproduct of this request history is handled in a case
insensitive
- way. This can now be controlled by setting case_sensitive to True when
creating
- an adapter or globally.']
+ features:
+ - You can pass case_sensitive=True to an adapter or set
`requests_mock.mock.case_sensitive
+ = True` globally to enable case sensitive matching.
+ fixes:
+ - Reported in bug \#1584008 all request matching is done in a case
insensitive
+ way, as a byproduct of this request history is handled in a case
insensitive
+ way. This can now be controlled by setting case_sensitive to True when
creating
+ an adapter or globally.
prelude: 'It is now possible to make URL matching and request history not
lowercase
the provided URLs.
'
- upgrade: [It is recommended you add `requests_mock.mock.case_sensitive =
True`
- to your base test file to globally turn on case sensitive matching as
this
- will become the default in a 2.X release.]
+ upgrade:
+ - It is recommended you add `requests_mock.mock.case_sensitive = True` to
your
+ base test file to globally turn on case sensitive matching as this will
become
+ the default in a 2.X release.
releasenotes/notes/fix-pytest-version-discovery-43f27e7e162ed055.yaml:
- fixes: [Fixed a bug relating to how the pytest version was being
discovered that
- meant new versions of pytest were being treated as old versions and
would
- receive bad configuration.]
- releasenotes/notes/fixture-extras-699a5b5fb5bd6aab.yaml: {features: 'Added
''fixture''
- to pip extras so you can install the fixture requirements with `pip
install
- requests-mock[fixture]`', prelude: 'Installing the requirements for the
''fixture''
- contrib package can now be done via pip with `pip install
requests-mock[fixture]`
+ fixes:
+ - Fixed a bug relating to how the pytest version was being discovered that
meant
+ new versions of pytest were being treated as old versions and would
receive
+ bad configuration.
+ releasenotes/notes/fixture-extras-699a5b5fb5bd6aab.yaml:
+ features: Added 'fixture' to pip extras so you can install the fixture
requirements
+ with `pip install requests-mock[fixture]`
+ prelude: 'Installing the requirements for the ''fixture'' contrib package
can
+ now be done via pip with `pip install requests-mock[fixture]`
- '}
+ '
releasenotes/notes/py.test-2-4e7735793288ea2d.yaml:
- fixes: [The py.test plugin was broken when using py.test < 3.0. The
version of
- py.test that ships in EPEL is only 2.7 so we need to make sure we
support
- at least that version.]
+ fixes:
+ - The py.test plugin was broken when using py.test < 3.0. The version of
py.test
+ that ships in EPEL is only 2.7 so we need to make sure we support at
least that
+ version.
prelude: 'Fix py.test plugin with py.test < 3.0
'
releasenotes/notes/pytest-7e35da8c5f2cd428.yaml:
- features: [Added pytest fixture for native integration into pytest
projects.]
+ features:
+ - Added pytest fixture for native integration into pytest projects.
releasenotes/notes/repo-move-15e956e1d54c048b.yaml:
- other: ['In this release the main repository was moved off of OpenStack
provided
+ other:
+ - 'In this release the main repository was moved off of OpenStack provided
- infrastructure and onto github at
+ infrastructure and onto github at
- https://github.com/jamielennox/requests-mock. OpenStack has been a
great
+ https://github.com/jamielennox/requests-mock. OpenStack has been a great
- home for the project however requests-mock is a general python project
with
+ home for the project however requests-mock is a general python project
with
- no specific relationship to OpenStack and the unfamiliar
infrastructure was
+ no specific relationship to OpenStack and the unfamiliar infrastructure
was
- limiting contributes from the wider community.
+ limiting contributes from the wider community.
- ']
+ '
prelude: 'The primary repository is now at
https://github.com/jamielennox/requests-mock
'
releasenotes/notes/request-history-stream-f1d75b33adcd7e97.yaml:
- features: [The stream parameter is recorded when the request is sent and
available
- in request history in the same was as parameters like verify or
timeout.]
+ features:
+ - The stream parameter is recorded when the request is sent and available
in request
+ history in the same was as parameters like verify or timeout.
+ releasenotes/notes/user-response-encoding-b2eea39404140164.yaml:
+ fixes:
+ - 'If you specified a charset in the Content-Type of a response it would be
+
+ ignored and overriden with either ''utf-8'' or None depending on the
type of
+
+ response content passed in. If you pass this value we should honour it
and
+
+ perform the encoding correctly.
+
+ '
notes:
- files:
+ - - releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
+ - !!binary |
+ YTBlOGZiNjFlMGJjYWRiODViMGRjYjFlYTNiN2E1ZDAyOTgyMWVlOA==
+ - - releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
+ - !!binary |
+ M2E3Yzk4ZjYzZDYyNWY2NzVjMzZkZjI3NzI0MTQ4ZmJlNzVmNTBhNg==
+ - - releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
+ - !!binary |
+ ZjRmM2IwYTYzMWE3NmI3M2JjMDg3NTdhNmI3ODA1NWU1YTdkNjgzNQ==
+ version: 1.6.0
+- files:
- - releasenotes/notes/fix-pytest-version-discovery-43f27e7e162ed055.yaml
- !!binary |
NDkwOWVhYzRhNzJhMDUyYjIwZWZmNzY5MDBmNDcwZmFlMWQzMjhmZA==
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-mock-1.5.2/releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
new/requests-mock-1.6.0/releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
---
old/requests-mock-1.5.2/releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
1970-01-01 01:00:00.000000000 +0100
+++
new/requests-mock-1.6.0/releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
2019-04-28 11:13:46.000000000 +0200
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ If you specified a charset in the Content-Type of a response it would be
+ ignored and overriden with either 'utf-8' or None depending on the type of
+ response content passed in. If you pass this value we should honour it and
+ perform the encoding correctly.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock/adapter.py
new/requests-mock-1.6.0/requests_mock/adapter.py
--- old/requests-mock-1.5.2/requests_mock/adapter.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock/adapter.py 2019-04-28
11:13:46.000000000 +0200
@@ -20,6 +20,13 @@
from requests_mock.request import _RequestObjectProxy
from requests_mock.response import _MatcherResponse
+try:
+ import purl
+ purl_types = (purl.URL,)
+except ImportError:
+ purl = None
+ purl_types = ()
+
ANY = object()
@@ -93,6 +100,16 @@
if not case_sensitive:
self._path = self._path.lower()
+ self._query = self._query.lower()
+
+ elif isinstance(url, purl_types):
+ self._scheme = url.scheme()
+ self._netloc = url.netloc()
+ self._path = url.path()
+ self._query = url.query()
+
+ if not case_sensitive:
+ self._path = self._path.lower()
self._query = self._query.lower()
else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock/mocker.py
new/requests-mock-1.6.0/requests_mock/mocker.py
--- old/requests-mock-1.5.2/requests_mock/mocker.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock/mocker.py 2019-04-28
11:13:46.000000000 +0200
@@ -56,6 +56,11 @@
requests_mock.mock.case_sensitive = True
+ or for pytest set in your configuration:
+
+ [pytest]
+ requests_mock_case_sensitive = True
+
which will prevent the lowercase being executed and return case sensitive
url and query information.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock/request.py
new/requests-mock-1.6.0/requests_mock/request.py
--- old/requests-mock-1.5.2/requests_mock/request.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock/request.py 2019-04-28
11:13:46.000000000 +0200
@@ -45,6 +45,12 @@
self._case_sensitive = kwargs.pop('case_sensitive', False)
def __getattr__(self, name):
+ # there should be a better way to exclude this, but I don't want to
+ # implement __setstate__ just not forward it to the request. You can't
+ # actually define the method and raise AttributeError there either.
+ if name in ('__setstate__',):
+ raise AttributeError(name)
+
return getattr(self._request, name)
@property
@@ -148,6 +154,12 @@
def json(self, **kwargs):
return json.loads(self.text, **kwargs)
+ def __getstate__(self):
+ # Can't pickle a weakref, but it's a weakref so ok to drop it.
+ d = self.__dict__.copy()
+ d['_matcher'] = None
+ return d
+
@property
def matcher(self):
"""The matcher that this request was handled by.
@@ -156,6 +168,10 @@
object if it is still available - so if the mock is still in place. If
the matcher is not available it will return None.
"""
+ # if unpickled or not from a response this will be None
+ if self._matcher is None:
+ return None
+
return self._matcher()
def __str__(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock/response.py
new/requests-mock-1.6.0/requests_mock/response.py
--- old/requests-mock-1.5.2/requests_mock/response.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock/response.py 2019-04-28
11:13:46.000000000 +0200
@@ -17,6 +17,7 @@
from requests.cookies import RequestsCookieJar
from requests.cookies import merge_cookies, cookiejar_from_dict
from requests.packages.urllib3.response import HTTPResponse
+from requests.utils import get_encoding_from_headers
import six
from requests_mock import compat
@@ -145,6 +146,7 @@
content = kwargs.pop('content', None)
text = kwargs.pop('text', None)
json = kwargs.pop('json', None)
+ headers = kwargs.pop('headers', {})
encoding = None
if content is not None and not isinstance(content, six.binary_type):
@@ -155,13 +157,13 @@
if json is not None:
text = jsonutils.dumps(json)
if text is not None:
- encoding = 'utf-8'
+ encoding = get_encoding_from_headers(headers) or 'utf-8'
content = text.encode(encoding)
if content is not None:
body = _IOReader(content)
if not raw:
raw = HTTPResponse(status=kwargs.get('status_code', _DEFAULT_STATUS),
- headers=kwargs.get('headers', {}),
+ headers=headers,
reason=kwargs.get('reason'),
body=body or _IOReader(six.b('')),
decode_content=False,
@@ -170,7 +172,9 @@
response = _http_adapter.build_response(request, raw)
response.connection = connection
- response.encoding = encoding
+
+ if encoding and not response.encoding:
+ response.encoding = encoding
_extract_cookies(request, response, kwargs.get('cookies'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock.egg-info/PKG-INFO
new/requests-mock-1.6.0/requests_mock.egg-info/PKG-INFO
--- old/requests-mock-1.5.2/requests_mock.egg-info/PKG-INFO 2018-07-21
05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock.egg-info/PKG-INFO 2019-04-28
11:14:07.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: requests-mock
-Version: 1.5.2
+Version: 1.6.0
Summary: Mock out responses from the requests package
Home-page: https://requests-mock.readthedocs.io/
Author: Jamie Lennox
@@ -110,6 +110,7 @@
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-mock-1.5.2/requests_mock.egg-info/SOURCES.txt
new/requests-mock-1.6.0/requests_mock.egg-info/SOURCES.txt
--- old/requests-mock-1.5.2/requests_mock.egg-info/SOURCES.txt 2018-07-21
05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock.egg-info/SOURCES.txt 2019-04-28
11:14:07.000000000 +0200
@@ -1,5 +1,6 @@
.coveragerc
.testr.conf
+.tox.oldest.txt
AUTHORS
ChangeLog
LICENSE
@@ -32,6 +33,8 @@
doc/source/release-notes.rst
doc/source/response.rst
releasenotes/notes/Add-called_once-property-a69546448cbd5542.yaml
+releasenotes/notes/Allow-pickling-response-fe751b0a760a5001.yaml
+releasenotes/notes/Bump-minimum-requests-2.3-70fd287f6ea1a12e.yaml
releasenotes/notes/additional-matcher-5c5cd466a6d70080.yaml
releasenotes/notes/case-insensitive-matching-a3143221359bbf2d.yaml
releasenotes/notes/fix-pytest-version-discovery-43f27e7e162ed055.yaml
@@ -40,6 +43,7 @@
releasenotes/notes/pytest-7e35da8c5f2cd428.yaml
releasenotes/notes/repo-move-15e956e1d54c048b.yaml
releasenotes/notes/request-history-stream-f1d75b33adcd7e97.yaml
+releasenotes/notes/user-response-encoding-b2eea39404140164.yaml
requests_mock/__init__.py
requests_mock/adapter.py
requests_mock/compat.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requests_mock.egg-info/pbr.json
new/requests-mock-1.6.0/requests_mock.egg-info/pbr.json
--- old/requests-mock-1.5.2/requests_mock.egg-info/pbr.json 2018-07-21
05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock.egg-info/pbr.json 2019-04-28
11:14:07.000000000 +0200
@@ -1 +1 @@
-{"git_version": "4909eac", "is_release": true}
\ No newline at end of file
+{"git_version": "722206a", "is_release": false}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-mock-1.5.2/requests_mock.egg-info/requires.txt
new/requests-mock-1.6.0/requests_mock.egg-info/requires.txt
--- old/requests-mock-1.5.2/requests_mock.egg-info/requires.txt 2018-07-21
05:58:10.000000000 +0200
+++ new/requests-mock-1.6.0/requests_mock.egg-info/requires.txt 2019-04-28
11:14:07.000000000 +0200
@@ -1,4 +1,4 @@
-requests>=1.1
+requests>=2.3
six
[fixture]
@@ -7,6 +7,7 @@
[test]
fixtures
mock
+purl
pytest
sphinx
testrepository>=0.0.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/requirements.txt
new/requests-mock-1.6.0/requirements.txt
--- old/requests-mock-1.5.2/requirements.txt 2018-07-21 05:57:52.000000000
+0200
+++ new/requests-mock-1.6.0/requirements.txt 2019-04-28 11:13:46.000000000
+0200
@@ -1,2 +1,2 @@
-requests>=1.1
+requests>=2.3
six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/setup.cfg
new/requests-mock-1.6.0/setup.cfg
--- old/requests-mock-1.5.2/setup.cfg 2018-07-21 05:58:11.000000000 +0200
+++ new/requests-mock-1.6.0/setup.cfg 2019-04-28 11:14:08.000000000 +0200
@@ -20,6 +20,7 @@
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Testing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/test-requirements.txt
new/requests-mock-1.6.0/test-requirements.txt
--- old/requests-mock-1.5.2/test-requirements.txt 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/test-requirements.txt 2019-04-28
11:13:46.000000000 +0200
@@ -1,5 +1,6 @@
fixtures
mock
+purl
pytest
sphinx
testrepository>=0.0.18
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/tests/test_adapter.py
new/requests-mock-1.6.0/tests/test_adapter.py
--- old/requests-mock-1.5.2/tests/test_adapter.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/tests/test_adapter.py 2019-04-28
11:13:46.000000000 +0200
@@ -13,6 +13,7 @@
import json
import re
+import purl
import requests
import six
from six.moves.urllib import parse as urlparse
@@ -327,6 +328,14 @@
resp = self.session.get(u)
self.assertEqual('resp', resp.text)
+ def test_with_purl(self):
+ self.adapter.register_uri('GET',
+ purl.URL('mock://www.tester.com/a'),
+ text='resp')
+
+ resp = self.session.get('mock://www.tester.com/a')
+ self.assertEqual('resp', resp.text)
+
def test_requests_in_history_on_no_match(self):
self.assertRaises(requests_mock.NoMockAddress,
self.session.get,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/tests/test_mocker.py
new/requests-mock-1.6.0/tests/test_mocker.py
--- old/requests-mock-1.5.2/tests/test_mocker.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/tests/test_mocker.py 2019-04-28
11:13:46.000000000 +0200
@@ -10,10 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
+import pickle
+
import mock
import requests
import requests_mock
+from requests_mock import adapter
from requests_mock import exceptions
from requests_mock import response
from . import base
@@ -441,3 +444,19 @@
requests.post,
url,
data='goodbye world')
+
+ @requests_mock.mock()
+ def test_mocker_pickle(self, m):
+ url = 'http://www.example.com'
+ text = 'hello world'
+ m.get(url, text=text)
+
+ orig_resp = requests.get(url)
+ self.assertEqual(text, orig_resp.text)
+
+ d = pickle.dumps(orig_resp)
+ new_resp = pickle.loads(d)
+
+ self.assertEqual(text, new_resp.text)
+ self.assertIsInstance(orig_resp.request.matcher, adapter._Matcher)
+ self.assertIsNone(new_resp.request.matcher)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/tests/test_response.py
new/requests-mock-1.6.0/tests/test_response.py
--- old/requests-mock-1.5.2/tests/test_response.py 2018-07-21
05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/tests/test_response.py 2019-04-28
11:13:46.000000000 +0200
@@ -10,6 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import pickle
import six
from requests_mock import adapter
@@ -110,3 +111,22 @@
self.assertEqual('apple', resp.cookies['sugar'])
self.assertEqual({'/foo', '/bar'}, set(resp.cookies.list_paths()))
self.assertEqual(['.test.url'], resp.cookies.list_domains())
+
+ def test_response_pickle(self):
+ text = 'hello world'
+ jar = response.CookieJar()
+ jar.set('fig', 'newton', path='/foo', domain='.test.url')
+ orig_resp = self.create_response(cookies=jar, text=text)
+
+ d = pickle.dumps(orig_resp)
+ new_resp = pickle.loads(d)
+
+ self.assertEqual(text, new_resp.text)
+ self.assertEqual('newton', new_resp.cookies['fig'])
+ self.assertIsNone(new_resp.request.matcher)
+
+ def test_response_encoding(self):
+ headers = {"content-type": "text/html; charset=ISO-8859-1"}
+ resp = self.create_response(headers=headers,
+ text="<html><body></body></html")
+ self.assertEqual('ISO-8859-1', resp.encoding)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-mock-1.5.2/tox.ini
new/requests-mock-1.6.0/tox.ini
--- old/requests-mock-1.5.2/tox.ini 2018-07-21 05:57:52.000000000 +0200
+++ new/requests-mock-1.6.0/tox.ini 2019-04-28 11:13:46.000000000 +0200
@@ -1,5 +1,5 @@
[tox]
-envlist = py36,py35,py34,py27,pypy,pep8
+envlist = py37,py36,py35,py34,py27,pypy3,pypy,pep8
[testenv]
setenv =
@@ -30,10 +30,14 @@
coverage
{[testenv]deps}
-[testenv:requests123]
+[testenv:oldest-requirements]
+install_command = pip install -U {opts} -c {toxinidir}/.tox.oldest.txt
{packages}
commands =
- {envbindir}/pip install "requests==1.2.3"
python setup.py testr --testr-args='{posargs}'
+deps =
+ -r{toxinidir}/test-requirements.txt
+ -c{toxinidir}/.tox.oldest.txt
+ pbr
[testenv:doctest]
# note this only works under python 3 because of unicode literals