Hello community,
here is the log from the commit of package python-aioresponses for
openSUSE:Factory checked in at 2019-10-09 15:20:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-aioresponses (Old)
and /work/SRC/openSUSE:Factory/.python-aioresponses.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-aioresponses"
Wed Oct 9 15:20:31 2019 rev:5 rq:736423 version:0.6.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-aioresponses/python-aioresponses.changes
2019-04-17 10:07:31.266721308 +0200
+++
/work/SRC/openSUSE:Factory/.python-aioresponses.new.2352/python-aioresponses.changes
2019-10-09 15:20:34.592325189 +0200
@@ -1,0 +2,6 @@
+Wed Oct 9 08:42:16 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.6.1:
+ * no upstream changelog
+
+-------------------------------------------------------------------
Old:
----
aioresponses-0.6.0.tar.gz
New:
----
aioresponses-0.6.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-aioresponses.spec ++++++
--- /var/tmp/diff_new_pack.WRn2aC/_old 2019-10-09 15:20:35.188323652 +0200
+++ /var/tmp/diff_new_pack.WRn2aC/_new 2019-10-09 15:20:35.192323642 +0200
@@ -19,11 +19,10 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-aioresponses
-Version: 0.6.0
+Version: 0.6.1
Release: 0
Summary: Python module for mocking out requests made by ClientSession
from aiohttp
License: MIT
-Group: Development/Languages/Python
URL: https://github.com/pnuckowski/aioresponses
Source:
https://files.pythonhosted.org/packages/source/a/aioresponses/aioresponses-%{version}.tar.gz
Patch0: disable-online-test.patch
++++++ aioresponses-0.6.0.tar.gz -> aioresponses-0.6.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/.coveragerc
new/aioresponses-0.6.1/.coveragerc
--- old/aioresponses-0.6.0/.coveragerc 2017-05-07 08:18:31.000000000 +0200
+++ new/aioresponses-0.6.1/.coveragerc 2019-10-01 23:32:40.000000000 +0200
@@ -3,4 +3,3 @@
[report]
omit = /usr*,setup.py,*egg*,.venv/*,*/tests/*
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/.travis.yml
new/aioresponses-0.6.1/.travis.yml
--- old/aioresponses-0.6.0/.travis.yml 2019-01-08 12:24:15.000000000 +0100
+++ new/aioresponses-0.6.1/.travis.yml 2019-10-01 23:32:40.000000000 +0200
@@ -46,22 +46,32 @@
env: TOXENV=py36-aiohttp34
- python: 3.6
env: TOXENV=py36-aiohttp35
- # - python: 3.6
- # env: TOXENV=py36-aiohttpmaster
- #
- - python: 3.6
+ - python: 3.7
+ dist: xenial
+ env: TOXENV=py37-aiohttp33
+ - python: 3.7
+ dist: xenial
+ env: TOXENV=py37-aiohttp34
+ - python: 3.7
+ dist: xenial
+ env: TOXENV=py37-aiohttp35
+# - python: 3.7
+# dist: xenial
+# env: TOXENV=py36-aiohttp-master
+
+
+ - python: 3.7
+ dist: xenial
env: TOXENV=flake8
- - python: 3.6
- env: TOXENV=coverage
-# command to install dependencies, e.g. pip install -r requirements.txt
--use-mirrors
-install: pip install -U tox coveralls
+env:
+ global:
+ - PYTEST_ADDOPTS="--cov --cov-report=xml"
+
+install: pip install -U tox
after_success:
-- coveralls
+ - bash <(curl -s https://codecov.io/bash) -Z -X coveragepy -X gcov -X xcode
-f coverage.xml
-# command to run tests, e.g. python setup.py test
script: tox -e ${TOXENV}
-
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/AUTHORS
new/aioresponses-0.6.1/AUTHORS
--- old/aioresponses-0.6.0/AUTHORS 2019-01-21 22:04:41.000000000 +0100
+++ new/aioresponses-0.6.1/AUTHORS 2019-10-02 00:02:39.000000000 +0200
@@ -1,3 +1,4 @@
+Alan Briolat <[email protected]>
Alexey Sveshnikov <[email protected]>
Alexey Sveshnikov <[email protected]>
Allisson Azevedo <[email protected]>
@@ -5,6 +6,8 @@
Anthony Lukach <[email protected]>
Brett Wandel <[email protected]>
Bryce Drennan <[email protected]>
+Daniel Hahler <[email protected]>
+Ilaï Deutel <[email protected]>
Joongi Kim <[email protected]>
Jordi Soucheiron <[email protected]>
Jordi Soucheiron <[email protected]>
@@ -16,6 +19,7 @@
Pavel Savchenko <[email protected]>
Pawel Nuckowski <[email protected]>
Rémy HUBSCHER <[email protected]>
+Ulrik Johansson <[email protected]>
pnuckowski <[email protected]>
pyup-bot <[email protected]>
vangheem <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/AUTHORS.rst
new/aioresponses-0.6.1/AUTHORS.rst
--- old/aioresponses-0.6.0/AUTHORS.rst 2016-10-17 20:18:11.000000000 +0200
+++ new/aioresponses-0.6.1/AUTHORS.rst 2019-10-02 00:01:32.000000000 +0200
@@ -5,7 +5,7 @@
Development Lead
----------------
-* Paweł Nuckowski <[email protected]>
+* Pawel Nuckowski <[email protected]>
Contributors
------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/ChangeLog
new/aioresponses-0.6.1/ChangeLog
--- old/aioresponses-0.6.0/ChangeLog 2019-01-21 22:04:41.000000000 +0100
+++ new/aioresponses-0.6.1/ChangeLog 2019-10-02 00:02:39.000000000 +0200
@@ -1,6 +1,23 @@
CHANGES
=======
+0.6.1
+-----
+
+* remove non ascii characters from my name
+* Pass loop to ResponseHandler for aiohttp 4
+* fixup! fixup! ci: run coverage for all jobs, use codecov
+* fixup! ci: run coverage for all jobs, use codecov
+* Cleanup tox config
+* tox: testenv: use pytest
+* ci: run coverage for all jobs, use codecov
+* Improve compat code
+* fix import in readme
+* add py3.7 to tests
+* Take raise\_for\_status into account
+* Add Pattern to type signatures for url
+* Support coroutine callbacks
+
0.6.0
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/PKG-INFO
new/aioresponses-0.6.1/PKG-INFO
--- old/aioresponses-0.6.0/PKG-INFO 2019-01-21 22:04:43.000000000 +0100
+++ new/aioresponses-0.6.1/PKG-INFO 2019-10-02 00:02:41.000000000 +0200
@@ -1,9 +1,9 @@
Metadata-Version: 1.1
Name: aioresponses
-Version: 0.6.0
+Version: 0.6.1
Summary: Mock out requests made by ClientSession from aiohttp package
Home-page: https://github.com/pnuckowski/aioresponses
-Author: Paweł Nuckowski
+Author: Pawel Nuckowski
Author-email: [email protected]
License: UNKNOWN
Description: ===============================
@@ -184,7 +184,8 @@
.. code:: python
import asyncio
- from aiohttp import ClientSession, HttpProcessingError
+ from aiohttp import ClientSession
+ from aiohttp.http_exceptions import HttpProcessingError
from aioresponses import aioresponses
@aioresponses()
@@ -261,3 +262,4 @@
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/README.rst
new/aioresponses-0.6.1/README.rst
--- old/aioresponses-0.6.0/README.rst 2019-01-21 22:02:56.000000000 +0100
+++ new/aioresponses-0.6.1/README.rst 2019-10-01 23:32:40.000000000 +0200
@@ -176,7 +176,8 @@
.. code:: python
import asyncio
- from aiohttp import ClientSession, HttpProcessingError
+ from aiohttp import ClientSession
+ from aiohttp.http_exceptions import HttpProcessingError
from aioresponses import aioresponses
@aioresponses()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses/__version__.py
new/aioresponses-0.6.1/aioresponses/__version__.py
--- old/aioresponses-0.6.0/aioresponses/__version__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/aioresponses-0.6.1/aioresponses/__version__.py 2019-06-21
22:10:02.000000000 +0200
@@ -0,0 +1,5 @@
+# -*- coding: utf-8 -*-
+import logging
+
+logger = logging.getLogger(__name__)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses/compat.py
new/aioresponses-0.6.1/aioresponses/compat.py
--- old/aioresponses-0.6.0/aioresponses/compat.py 2019-01-21
22:02:56.000000000 +0100
+++ new/aioresponses-0.6.1/aioresponses/compat.py 2019-10-01
23:32:40.000000000 +0200
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-import asyncio # noqa
-import re
+import asyncio # noqa: F401
+import sys
from distutils.version import StrictVersion
from typing import Dict, Optional, Tuple, Union # noqa
from urllib.parse import parse_qsl, urlencode
@@ -9,11 +9,10 @@
from multidict import MultiDict
from yarl import URL
-try:
- Pattern = re._pattern_type
-except AttributeError: # pragma: no cover
- # Python 3.7
- Pattern = re.Pattern
+if sys.version_info < (3, 7):
+ from re import _pattern_type as Pattern
+else:
+ from re import Pattern
AIOHTTP_VERSION = StrictVersion(aiohttp_version)
@@ -24,11 +23,11 @@
loop: 'Optional[asyncio.AbstractEventLoop]' = None
):
protocol = ResponseHandler(loop=loop)
- return StreamReader(protocol)
+ return StreamReader(protocol, loop=loop)
-else: # pragma: no cover
+else:
- def stream_reader_factory():
+ def stream_reader_factory(loop=None):
return StreamReader()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses/core.py
new/aioresponses-0.6.1/aioresponses/core.py
--- old/aioresponses-0.6.0/aioresponses/core.py 2019-01-21 22:02:56.000000000
+0100
+++ new/aioresponses-0.6.1/aioresponses/core.py 2019-10-01 23:32:40.000000000
+0200
@@ -50,7 +50,7 @@
class RequestMatch(object):
url_or_pattern = None # type: Union[URL, Pattern]
- def __init__(self, url: Union[str, Pattern],
+ def __init__(self, url: Union[URL, str, Pattern],
method: str = hdrs.METH_GET,
status: int = 200,
body: str = '',
@@ -139,6 +139,8 @@
kwargs['traces'] = []
kwargs['loop'] = loop
kwargs['session'] = None
+ else:
+ loop = None
# We need to initialize headers manually
_headers = CIMultiDict({hdrs.CONTENT_TYPE: content_type})
if headers:
@@ -154,7 +156,7 @@
resp.raw_headers = raw_headers
resp.status = status
resp.reason = reason
- resp.content = stream_reader_factory()
+ resp.content = stream_reader_factory(loop)
resp.content.feed_data(body)
resp.content.feed_eof()
return resp
@@ -165,7 +167,10 @@
if isinstance(self.exception, Exception):
return self.exception
if callable(self.callback):
- result = self.callback(url, **kwargs)
+ if asyncio.iscoroutinefunction(self.callback):
+ result = await self.callback(url, **kwargs)
+ else:
+ result = self.callback(url, **kwargs)
else:
result = None
result = self if result is None else result
@@ -244,28 +249,28 @@
self.patcher.stop()
self.clear()
- def head(self, url: 'Union[URL, str]', **kwargs):
+ def head(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_HEAD, **kwargs)
- def get(self, url: 'Union[URL, str]', **kwargs):
+ def get(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_GET, **kwargs)
- def post(self, url: 'Union[URL, str]', **kwargs):
+ def post(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_POST, **kwargs)
- def put(self, url: 'Union[URL, str]', **kwargs):
+ def put(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_PUT, **kwargs)
- def patch(self, url: 'Union[URL, str]', **kwargs):
+ def patch(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_PATCH, **kwargs)
- def delete(self, url: 'Union[URL, str]', **kwargs):
+ def delete(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_DELETE, **kwargs)
- def options(self, url: 'Union[URL, str]', **kwargs):
+ def options(self, url: 'Union[URL, str, Pattern]', **kwargs):
self.add(url, method=hdrs.METH_OPTIONS, **kwargs)
- def add(self, url: 'Union[URL, str]', method: str = hdrs.METH_GET,
+ def add(self, url: 'Union[URL, str, Pattern]', method: str = hdrs.METH_GET,
status: int = 200,
body: str = '',
exception: 'Exception' = None,
@@ -331,4 +336,18 @@
key = (method, url)
self.requests.setdefault(key, [])
self.requests[key].append(RequestCall(args, kwargs))
+
+ # Automatically call response.raise_for_status() on a request if the
+ # request was initialized with raise_for_status=True. Also call
+ # response.raise_for_status() if the client session was initialized
+ # with raise_for_status=True, unless the request was called with
+ # raise_for_status=False.
+ raise_for_status = kwargs.get('raise_for_status')
+ if raise_for_status is None:
+ raise_for_status = getattr(
+ orig_self, '_raise_for_status', False
+ )
+ if raise_for_status:
+ response.raise_for_status()
+
return response
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses.egg-info/PKG-INFO
new/aioresponses-0.6.1/aioresponses.egg-info/PKG-INFO
--- old/aioresponses-0.6.0/aioresponses.egg-info/PKG-INFO 2019-01-21
22:04:41.000000000 +0100
+++ new/aioresponses-0.6.1/aioresponses.egg-info/PKG-INFO 2019-10-02
00:02:39.000000000 +0200
@@ -1,9 +1,9 @@
Metadata-Version: 1.1
Name: aioresponses
-Version: 0.6.0
+Version: 0.6.1
Summary: Mock out requests made by ClientSession from aiohttp package
Home-page: https://github.com/pnuckowski/aioresponses
-Author: Paweł Nuckowski
+Author: Pawel Nuckowski
Author-email: [email protected]
License: UNKNOWN
Description: ===============================
@@ -184,7 +184,8 @@
.. code:: python
import asyncio
- from aiohttp import ClientSession, HttpProcessingError
+ from aiohttp import ClientSession
+ from aiohttp.http_exceptions import HttpProcessingError
from aioresponses import aioresponses
@aioresponses()
@@ -261,3 +262,4 @@
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses.egg-info/SOURCES.txt
new/aioresponses-0.6.1/aioresponses.egg-info/SOURCES.txt
--- old/aioresponses-0.6.0/aioresponses.egg-info/SOURCES.txt 2019-01-21
22:04:42.000000000 +0100
+++ new/aioresponses-0.6.1/aioresponses.egg-info/SOURCES.txt 2019-10-02
00:02:40.000000000 +0200
@@ -18,6 +18,7 @@
tox.ini
unittest.cfg
aioresponses/__init__.py
+aioresponses/__version__.py
aioresponses/compat.py
aioresponses/core.py
aioresponses.egg-info/PKG-INFO
@@ -39,17 +40,6 @@
docs/modules.rst
docs/readme.rst
docs/usage.rst
-docs/_build/html/_static/ajax-loader.gif
-docs/_build/html/_static/comment-bright.png
-docs/_build/html/_static/comment-close.png
-docs/_build/html/_static/comment.png
-docs/_build/html/_static/down-pressed.png
-docs/_build/html/_static/down.png
-docs/_build/html/_static/file.png
-docs/_build/html/_static/minus.png
-docs/_build/html/_static/plus.png
-docs/_build/html/_static/up-pressed.png
-docs/_build/html/_static/up.png
tests/__init__.py
tests/test_aioresponses.py
tests/test_compat.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/aioresponses.egg-info/pbr.json
new/aioresponses-0.6.1/aioresponses.egg-info/pbr.json
--- old/aioresponses-0.6.0/aioresponses.egg-info/pbr.json 2019-01-21
22:04:41.000000000 +0100
+++ new/aioresponses-0.6.1/aioresponses.egg-info/pbr.json 2019-10-02
00:02:39.000000000 +0200
@@ -1 +1 @@
-{"git_version": "566461a", "is_release": false}
\ No newline at end of file
+{"git_version": "80368be", "is_release": false}
\ No newline at end of file
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/ajax-loader.gif
and new/aioresponses-0.6.1/docs/_build/html/_static/ajax-loader.gif differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/comment-bright.png
and new/aioresponses-0.6.1/docs/_build/html/_static/comment-bright.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/comment-close.png
and new/aioresponses-0.6.1/docs/_build/html/_static/comment-close.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/comment.png and
new/aioresponses-0.6.1/docs/_build/html/_static/comment.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/down-pressed.png
and new/aioresponses-0.6.1/docs/_build/html/_static/down-pressed.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/down.png and
new/aioresponses-0.6.1/docs/_build/html/_static/down.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/file.png and
new/aioresponses-0.6.1/docs/_build/html/_static/file.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/minus.png and
new/aioresponses-0.6.1/docs/_build/html/_static/minus.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/plus.png and
new/aioresponses-0.6.1/docs/_build/html/_static/plus.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/up-pressed.png and
new/aioresponses-0.6.1/docs/_build/html/_static/up-pressed.png differ
Binary files old/aioresponses-0.6.0/docs/_build/html/_static/up.png and
new/aioresponses-0.6.1/docs/_build/html/_static/up.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/docs/conf.py
new/aioresponses-0.6.1/docs/conf.py
--- old/aioresponses-0.6.0/docs/conf.py 2016-10-17 20:18:11.000000000 +0200
+++ new/aioresponses-0.6.1/docs/conf.py 2019-10-02 00:01:32.000000000 +0200
@@ -56,7 +56,7 @@
# General information about the project.
project = u'aioresponses'
-copyright = u"2016, Paweł Nuckowski"
+copyright = u"2016, Pawel Nuckowski"
# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
@@ -210,7 +210,7 @@
latex_documents = [
('index', 'aioresponses.tex',
u'aioresponses Documentation',
- u'Paweł Nuckowski', 'manual'),
+ u'Pawel Nuckowski', 'manual'),
]
# The name of an image file (relative to this directory) to place at
@@ -241,7 +241,7 @@
man_pages = [
('index', 'aioresponses',
u'aioresponses Documentation',
- [u'Paweł Nuckowski'], 1)
+ [u'Pawel Nuckowski'], 1)
]
# If true, show URL addresses after external links.
@@ -256,7 +256,7 @@
texinfo_documents = [
('index', 'aioresponses',
u'aioresponses Documentation',
- u'Paweł Nuckowski',
+ u'Pawel Nuckowski',
'aioresponses',
'One line description of project.',
'Miscellaneous'),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/setup.cfg
new/aioresponses-0.6.1/setup.cfg
--- old/aioresponses-0.6.0/setup.cfg 2019-01-21 22:04:43.000000000 +0100
+++ new/aioresponses-0.6.1/setup.cfg 2019-10-02 00:02:41.000000000 +0200
@@ -1,6 +1,6 @@
[metadata]
name = aioresponses
-author = Paweł Nuckowski
+author = Pawel Nuckowski
author-email = [email protected]
summary = Mock out requests made by ClientSession from aiohttp package
description-file = README.rst
@@ -15,6 +15,7 @@
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
[files]
packages =
@@ -31,6 +32,9 @@
[flake8]
exclude = docs
+[tool:pytest]
+testpaths = tests
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/tests/test_aioresponses.py
new/aioresponses-0.6.1/tests/test_aioresponses.py
--- old/aioresponses-0.6.0/tests/test_aioresponses.py 2019-01-21
22:02:56.000000000 +0100
+++ new/aioresponses-0.6.1/tests/test_aioresponses.py 2019-10-01
23:32:40.000000000 +0200
@@ -8,7 +8,7 @@
from aiohttp import http
from aiohttp.client import ClientSession
from aiohttp.client_reqrep import ClientResponse
-from asynctest import fail_on
+from asynctest import fail_on, skipIf
from asynctest.case import TestCase
from ddt import ddt, data
@@ -25,7 +25,7 @@
)
from aiohttp.http_exceptions import HttpProcessingError
-from aioresponses.compat import URL
+from aioresponses.compat import AIOHTTP_VERSION, URL
from aioresponses import CallbackResult, aioresponses
@@ -119,6 +119,17 @@
@aioresponses()
@asyncio.coroutine
+ @skipIf(condition=AIOHTTP_VERSION < '3.4.0',
+ reason='aiohttp<3.4.0 does not support raise_for_status '
+ 'arguments for requests')
+ def test_request_raise_for_status(self, m):
+ m.get(self.url, status=400)
+ with self.assertRaises(ClientResponseError) as cm:
+ yield from self.session.get(self.url, raise_for_status=True)
+ self.assertEqual(cm.exception.message, http.RESPONSES[400][0])
+
+ @aioresponses()
+ @asyncio.coroutine
def test_returned_instance_and_params_handling(self, m):
expected_url = 'http://example.com/api?foo=bar&x=42#fragment'
m.get(expected_url)
@@ -328,3 +339,71 @@
response = self.run_async(self.request(self.url))
data = self.run_async(response.read())
assert data == body
+
+ @aioresponses()
+ def test_callback_coroutine(self, m):
+ body = b'New body'
+ event = asyncio.Event()
+
+ @asyncio.coroutine
+ def callback(url, **kwargs):
+ yield from event.wait()
+ self.assertEqual(str(url), self.url)
+ self.assertEqual(kwargs, {'allow_redirects': True})
+ return CallbackResult(body=body)
+
+ m.get(self.url, callback=callback)
+ future = asyncio.ensure_future(self.request(self.url))
+ self.run_async(asyncio.wait([future], timeout=0))
+ assert not future.done()
+ event.set()
+ self.run_async(asyncio.wait([future], timeout=0))
+ assert future.done()
+ response = future.result()
+ data = self.run_async(response.read())
+ assert data == body
+
+
+class AIOResponsesRaiseForStatusSessionTestCase(TestCase):
+ """Test case for sessions with raise_for_status=True.
+
+ This flag, introduced in aiohttp v2.0.0, automatically calls
+ `raise_for_status()`.
+ It is overriden by the `raise_for_status` argument of the request since
+ aiohttp v3.4.a0.
+
+ """
+ use_default_loop = False
+
+ @asyncio.coroutine
+ def setUp(self):
+ self.url = 'http://example.com/api?foo=bar#fragment'
+ self.session = ClientSession(raise_for_status=True)
+ super().setUp()
+
+ @asyncio.coroutine
+ def tearDown(self):
+ close_result = self.session.close()
+ if close_result is not None:
+ yield from close_result
+ super().tearDown()
+
+ @aioresponses()
+ @asyncio.coroutine
+ def test_raise_for_status(self, m):
+ m.get(self.url, status=400)
+ with self.assertRaises(ClientResponseError) as cm:
+ yield from self.session.get(self.url)
+ self.assertEqual(cm.exception.message, http.RESPONSES[400][0])
+
+ @aioresponses()
+ @asyncio.coroutine
+ @skipIf(condition=AIOHTTP_VERSION < '3.4.0',
+ reason='aiohttp<3.4.0 does not support raise_for_status '
+ 'arguments for requests')
+ def test_do_not_raise_for_status(self, m):
+ m.get(self.url, status=400)
+ response = yield from self.session.get(self.url,
+ raise_for_status=False)
+
+ self.assertEqual(response.status, 400)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.6.0/tox.ini
new/aioresponses-0.6.1/tox.ini
--- old/aioresponses-0.6.0/tox.ini 2019-01-21 22:02:56.000000000 +0100
+++ new/aioresponses-0.6.1/tox.ini 2019-10-01 23:32:40.000000000 +0200
@@ -11,7 +11,6 @@
skipsdist = True
[testenv:flake8]
-basepython = python
deps = flake8
commands = flake8 aioresponses
@@ -20,6 +19,8 @@
PYTHONDONTWRITEBYTECODE=1
PYTHONPATH = {toxinidir}:{toxinidir}/aioresponses
+passenv = PYTEST_ADDOPTS
+
deps =
aiohttp20: aiohttp>=2.0,<2.1
aiohttp20: yarl<1.2.0
@@ -37,18 +38,4 @@
aiohttp-master: https://github.com/aio-libs/aiohttp/archive/master.tar.gz
-r{toxinidir}/requirements-dev.txt
-basepython =
- py35: python3.5
- py36: python3.6
- py37: python3.7
-
-commands = python setup.py test
-
-[testenv:coverage]
-basepython = python
-commands = coverage run --source=aioresponses setup.py test
-
-[testenv:cov_html]
-basepython = python
-deps = aiohttp
-commands = pytest --cov=aioresponses/ --cov-report=html --cov-report=xml
+commands = python -m pytest {posargs}