Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-aioresponses for
openSUSE:Factory checked in at 2022-01-15 20:05:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-aioresponses (Old)
and /work/SRC/openSUSE:Factory/.python-aioresponses.new.1892 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-aioresponses"
Sat Jan 15 20:05:25 2022 rev:11 rq:946669 version:0.7.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-aioresponses/python-aioresponses.changes
2021-01-18 14:46:06.862046545 +0100
+++
/work/SRC/openSUSE:Factory/.python-aioresponses.new.1892/python-aioresponses.changes
2022-01-15 20:05:46.753786105 +0100
@@ -1,0 +2,18 @@
+Sat Jan 15 16:37:25 UTC 2022 - Dirk M??ller <[email protected]>
+
+- update to 0.7.3:
+ * Support binary bodies in responses
+ * fix flake8
+ * move RequestInfo to compat
+ * drop \`.travis.yml\`
+ * basic CI using github actions
+ * (feat) add unit tests
+ * (feat) allow for callbacks to be called before raising of exception
+ * add \`py.typed\` (PEP 561)
+ * Fix setuptools warnings by replacing dashes in keys with underscores
+ * fix version parsing
+ * version 0.7.2
+ * Update aioresponses/core.py
+ * adding catch to ignore ValueError when deepcopy is unsuccessful
+
+-------------------------------------------------------------------
Old:
----
aioresponses-0.7.1.tar.gz
New:
----
aioresponses-0.7.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-aioresponses.spec ++++++
--- /var/tmp/diff_new_pack.hEEISq/_old 2022-01-15 20:05:47.217786466 +0100
+++ /var/tmp/diff_new_pack.hEEISq/_new 2022-01-15 20:05:47.221786469 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-aioresponses
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python3-%{**}}
%define skip_python2 1
Name: python-aioresponses
-Version: 0.7.1
+Version: 0.7.3
Release: 0
Summary: Python module for mocking out requests made by ClientSession
from aiohttp
License: MIT
++++++ aioresponses-0.7.1.tar.gz -> aioresponses-0.7.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/.github/workflows/ci.yml
new/aioresponses-0.7.3/.github/workflows/ci.yml
--- old/aioresponses-0.7.1/.github/workflows/ci.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/aioresponses-0.7.3/.github/workflows/ci.yml 2021-10-28
22:55:04.000000000 +0200
@@ -0,0 +1,83 @@
+name: CI
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+concurrency:
+ group: ci-${{ github.ref }}-${{ github.actor }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ env:
+ PYTEST_ADDOPTS: "--cov --cov-report=xml"
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - python-version: 3.6
+ aiohttp-version: aiohttp30
+ - python-version: 3.6
+ aiohttp-version: aiohttp31
+ - python-version: 3.6
+ aiohttp-version: aiohttp32
+ - python-version: 3.6
+ aiohttp-version: aiohttp33
+ - python-version: 3.6
+ aiohttp-version: aiohttp34
+ - python-version: 3.6
+ aiohttp-version: aiohttp35
+ - python-version: 3.6
+ aiohttp-version: aiohttp36
+ - python-version: 3.6
+ aiohttp-version: aiohttp37
+
+ - python-version: 3.7
+ aiohttp-version: aiohttp33
+ - python-version: 3.7
+ aiohttp-version: aiohttp34
+ - python-version: 3.7
+ aiohttp-version: aiohttp35
+ - python-version: 3.7
+ aiohttp-version: aiohttp36
+ - python-version: 3.7
+ aiohttp-version: aiohttp37
+
+ - python-version: 3.8
+ aiohttp-version: aiohttp33
+ - python-version: 3.8
+ aiohttp-version: aiohttp34
+ - python-version: 3.8
+ aiohttp-version: aiohttp35
+ - python-version: 3.8
+ aiohttp-version: aiohttp36
+ - python-version: 3.8
+ aiohttp-version: aiohttp37
+
+ - python-version: 3.9
+ aiohttp-version: aiohttp35
+ - python-version: 3.9
+ aiohttp-version: aiohttp36
+ - python-version: 3.9
+ aiohttp-version: aiohttp37
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install Dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install tox
+ - name: Run Tests
+ run: |
+ tox -e py${{ matrix.python-version }}-${{ matrix.aiohttp-version }}
+ - uses: codecov/codecov-action@v2
+ with:
+ file: coverage.xml
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/.github/workflows/flake8.yml
new/aioresponses-0.7.3/.github/workflows/flake8.yml
--- old/aioresponses-0.7.1/.github/workflows/flake8.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/aioresponses-0.7.3/.github/workflows/flake8.yml 2021-10-28
22:55:04.000000000 +0200
@@ -0,0 +1,23 @@
+name: flake8
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ flake8:
+ runs-on: ubuntu-latest
+ name: run flake8
+ steps:
+ - name: Check out source repository
+ uses: actions/checkout@v2
+ - name: Set up Python environment
+ uses: actions/setup-python@v2
+ with:
+ python-version: "3.9"
+ - name: flake8 Lint
+ uses: reviewdog/action-flake8@v3
+ with:
+ github_token: ${{ secrets.GITHUB_TOKEN }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/.travis.yml
new/aioresponses-0.7.3/.travis.yml
--- old/aioresponses-0.7.1/.travis.yml 2020-10-29 14:49:21.000000000 +0100
+++ new/aioresponses-0.7.3/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,77 +0,0 @@
-# Config file for automatic testing at travis-ci.org
-# This file will be regenerated if you run travis_pypi_setup.py
-
-language: python
-
-matrix:
- include:
- - python: 3.6
- env: TOXENV=py36-aiohttp30
- - python: 3.6
- env: TOXENV=py36-aiohttp31
- - python: 3.6
- env: TOXENV=py36-aiohttp32
- - python: 3.6
- env: TOXENV=py36-aiohttp33
- - python: 3.6
- env: TOXENV=py36-aiohttp34
- - python: 3.6
- env: TOXENV=py36-aiohttp35
- - python: 3.6
- env: TOXENV=py36-aiohttp36
- - python: 3.6
- env: TOXENV=py36-aiohttp37
-
- - 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=py37-aiohttp36
- - python: 3.7
- dist: xenial
- env: TOXENV=py37-aiohttp37
-
- - python: 3.8
- dist: xenial
- env: TOXENV=py38-aiohttp33
- - python: 3.8
- dist: xenial
- env: TOXENV=py38-aiohttp34
- - python: 3.8
- dist: xenial
- env: TOXENV=py38-aiohttp35
- - python: 3.8
- dist: xenial
- env: TOXENV=py38-aiohttp36
- - python: 3.8
- dist: xenial
- env: TOXENV=py38-aiohttp37
-
- - python: 3.9
- dist: focal
- env: TOXENV=py39-aiohttp37
-# - python: 3.8
-# dist: xenial
-# env: TOXENV=py38-aiohttp-master
-
- - python: 3.8
- dist: xenial
- env: TOXENV=flake8
-
-env:
- global:
- - PYTEST_ADDOPTS="--cov --cov-report=xml"
-
-install: pip install -U tox
-
-after_success:
- - bash <(curl -s https://codecov.io/bash) -Z -X coveragepy -X gcov -X xcode
-f coverage.xml
-
-script: tox -e ${TOXENV}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/AUTHORS
new/aioresponses-0.7.3/AUTHORS
--- old/aioresponses-0.7.1/AUTHORS 2020-10-29 14:51:38.000000000 +0100
+++ new/aioresponses-0.7.3/AUTHORS 2022-01-10 23:39:35.000000000 +0100
@@ -10,19 +10,25 @@
Bryce Drennan <[email protected]>
Colin-b <[email protected]>
Daniel Hahler <[email protected]>
+Daniel Tan <[email protected]>
David Buxton <[email protected]>
+Gordon Rogers <[email protected]>
Hadrien David <[email protected]>
+Hadrien David <[email protected]>
Ila?? Deutel <[email protected]>
Joongi Kim <[email protected]>
Jordi Soucheiron <[email protected]>
Jordi Soucheiron <[email protected]>
Joshua Coats <[email protected]>
Lee Treveil <[email protected]>
+Louis Sautier <[email protected]>
Lukasz Jernas <[email protected]>
Marat Sharafutdinov <[email protected]>
+Marcin Sulikowski <[email protected]>
Marek Kowalski <[email protected]>
Pavel Savchenko <[email protected]>
Pawel Nuckowski <[email protected]>
+Petr Belskiy <[email protected]>
R??my HUBSCHER <[email protected]>
TyVik <[email protected]>
Ulrik Johansson <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/ChangeLog
new/aioresponses-0.7.3/ChangeLog
--- old/aioresponses-0.7.1/ChangeLog 2020-10-29 14:51:38.000000000 +0100
+++ new/aioresponses-0.7.3/ChangeLog 2022-01-10 23:39:35.000000000 +0100
@@ -1,6 +1,32 @@
CHANGES
=======
+0.7.3
+-----
+
+* Support binary bodies in responses
+* fix flake8
+* move RequestInfo to compat
+* drop \`.travis.yml\`
+* basic CI using github actions add codecov and add flake8
+* basic CI using github actions
+* basic CI using github actions
+* basic CI using github actions
+* basic CI using github actions
+* basic CI using github actions
+* (feat) add unit tests
+* (feat) allow for callbacks to be called before raising of exception
+* add \`py.typed\` (PEP 561)
+* Fix setuptools warnings by replacing dashes in keys with underscores
+
+0.7.2
+-----
+
+* fix version parsing
+* version 0.7.2
+* Update aioresponses/core.py
+* adding catch to ignore ValueError when deepcopy is unsuccessful
+
0.7.1
-----
@@ -25,6 +51,7 @@
* fixing - BaseException handling(in Pyhton 3.8 asyncio.CancelError,
asyncio.TimeoutError are subclass of BaseException) extend exception attribute
for RequestMatch - exception can be as class or as object of
exception(Exception or Exception())
* Load response cookies from headers
* changed variable names
+* fix: set request\_info on response rather than mock
0.6.3
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/PKG-INFO
new/aioresponses-0.7.3/PKG-INFO
--- old/aioresponses-0.7.1/PKG-INFO 2020-10-29 14:51:59.000000000 +0100
+++ new/aioresponses-0.7.3/PKG-INFO 2022-01-10 23:39:36.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aioresponses
-Version: 0.7.1
+Version: 0.7.3
Summary: Mock out requests made by ClientSession from aiohttp package
Home-page: https://github.com/pnuckowski/aioresponses
Author: Pawel Nuckowski
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses/__init__.py
new/aioresponses-0.7.3/aioresponses/__init__.py
--- old/aioresponses-0.7.1/aioresponses/__init__.py 2020-10-29
14:49:21.000000000 +0100
+++ new/aioresponses-0.7.3/aioresponses/__init__.py 2021-03-08
09:35:50.000000000 +0100
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from .core import CallbackResult, aioresponses
-__version__ = '0.7.1'
+__version__ = '0.7.2'
__all__ = [
'CallbackResult',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses/compat.py
new/aioresponses-0.7.3/aioresponses/compat.py
--- old/aioresponses-0.7.1/aioresponses/compat.py 2020-10-29
14:49:21.000000000 +0100
+++ new/aioresponses-0.7.3/aioresponses/compat.py 2022-01-10
23:36:41.000000000 +0100
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
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
from aiohttp import __version__ as aiohttp_version, StreamReader
from multidict import MultiDict
+from pkg_resources import parse_version
from yarl import URL
if sys.version_info < (3, 7):
@@ -14,9 +14,9 @@
else:
from re import Pattern
-AIOHTTP_VERSION = StrictVersion(aiohttp_version)
+AIOHTTP_VERSION = parse_version(aiohttp_version)
-if AIOHTTP_VERSION >= StrictVersion('3.0.0'):
+if AIOHTTP_VERSION >= parse_version('3.0.0'):
from aiohttp.client_proto import ResponseHandler
@@ -47,9 +47,24 @@
return url.with_query(urlencode(sorted(parse_qsl(url.query_string))))
+try:
+ from aiohttp import RequestInfo
+except ImportError:
+ class RequestInfo(object):
+ __slots__ = ('url', 'method', 'headers', 'real_url')
+
+ def __init__(
+ self, url: URL, method: str, headers: Dict, real_url: str
+ ):
+ self.url = url
+ self.method = method
+ self.headers = headers
+ self.real_url = real_url
+
__all__ = [
'URL',
'Pattern',
+ 'RequestInfo',
'AIOHTTP_VERSION',
'merge_params',
'stream_reader_factory',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses/core.py
new/aioresponses-0.7.3/aioresponses/core.py
--- old/aioresponses-0.7.1/aioresponses/core.py 2020-08-23 00:00:53.000000000
+0200
+++ new/aioresponses-0.7.3/aioresponses/core.py 2022-01-10 23:36:41.000000000
+0100
@@ -4,7 +4,6 @@
import inspect
import json
from collections import namedtuple
-from distutils.version import StrictVersion
from functools import wraps
from typing import Callable, Dict, Tuple, Union, Optional, List # noqa
from unittest.mock import Mock, patch
@@ -19,6 +18,7 @@
)
from aiohttp.helpers import TimerNoop
from multidict import CIMultiDict, CIMultiDictProxy
+from pkg_resources import parse_version
from .compat import (
AIOHTTP_VERSION,
@@ -27,6 +27,7 @@
stream_reader_factory,
merge_params,
normalize_url,
+ RequestInfo,
)
@@ -34,7 +35,7 @@
def __init__(self, method: str = hdrs.METH_GET,
status: int = 200,
- body: str = '',
+ body: Union[str, bytes] = '',
content_type: str = 'application/json',
payload: Dict = None,
headers: Dict = None,
@@ -56,7 +57,7 @@
def __init__(self, url: Union[URL, str, Pattern],
method: str = hdrs.METH_GET,
status: int = 200,
- body: str = '',
+ body: Union[str, bytes] = '',
payload: Dict = None,
exception: 'Exception' = None,
headers: Dict = None,
@@ -117,7 +118,7 @@
method: str = hdrs.METH_GET,
request_headers: Dict = None,
status: int = 200,
- body: str = '',
+ body: Union[str, bytes] = '',
content_type: str = 'application/json',
payload: Dict = None,
headers: Dict = None,
@@ -132,11 +133,11 @@
if request_headers is None:
request_headers = {}
kwargs = {}
- if AIOHTTP_VERSION >= StrictVersion('3.1.0'):
+ if AIOHTTP_VERSION >= parse_version('3.1.0'):
loop = Mock()
loop.get_debug = Mock()
loop.get_debug.return_value = True
- kwargs['request_info'] = Mock(
+ kwargs['request_info'] = RequestInfo(
url=url,
method=method,
headers=CIMultiDictProxy(CIMultiDict(**request_headers)),
@@ -144,7 +145,7 @@
kwargs['writer'] = Mock()
kwargs['continue100'] = None
kwargs['timer'] = TimerNoop()
- if AIOHTTP_VERSION < StrictVersion('3.3.0'):
+ if AIOHTTP_VERSION < parse_version('3.3.0'):
kwargs['auto_decompress'] = True
kwargs['traces'] = []
kwargs['loop'] = loop
@@ -161,7 +162,7 @@
for hdr in _headers.getall(hdrs.SET_COOKIE, ()):
resp.cookies.load(hdr)
- if AIOHTTP_VERSION >= StrictVersion('3.3.0'):
+ if AIOHTTP_VERSION >= parse_version('3.3.0'):
# Reified attributes
resp._headers = _headers
resp._raw_headers = raw_headers
@@ -178,9 +179,6 @@
async def build_response(
self, url: URL, **kwargs
) -> 'Union[ClientResponse, Exception]':
- if self.exception is not None:
- return self.exception
-
if callable(self.callback):
if asyncio.iscoroutinefunction(self.callback):
result = await self.callback(url, **kwargs)
@@ -188,6 +186,10 @@
result = self.callback(url, **kwargs)
else:
result = None
+
+ if self.exception is not None:
+ return self.exception
+
result = self if result is None else result
resp = self._build_response(
url=url,
@@ -288,7 +290,7 @@
def add(self, url: 'Union[URL, str, Pattern]', method: str = hdrs.METH_GET,
status: int = 200,
- body: str = '',
+ body: Union[str, bytes] = '',
exception: 'Exception' = None,
content_type: str = 'application/json',
payload: Dict = None,
@@ -382,7 +384,7 @@
self.requests.setdefault(key, [])
try:
kwargs_copy = copy.deepcopy(kwargs)
- except TypeError:
+ except (TypeError, ValueError):
# Handle the fact that some values cannot be deep copied
kwargs_copy = kwargs
self.requests[key].append(RequestCall(args, kwargs_copy))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses.egg-info/PKG-INFO
new/aioresponses-0.7.3/aioresponses.egg-info/PKG-INFO
--- old/aioresponses-0.7.1/aioresponses.egg-info/PKG-INFO 2020-10-29
14:51:38.000000000 +0100
+++ new/aioresponses-0.7.3/aioresponses.egg-info/PKG-INFO 2022-01-10
23:39:35.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: aioresponses
-Version: 0.7.1
+Version: 0.7.3
Summary: Mock out requests made by ClientSession from aiohttp package
Home-page: https://github.com/pnuckowski/aioresponses
Author: Pawel Nuckowski
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses.egg-info/SOURCES.txt
new/aioresponses-0.7.3/aioresponses.egg-info/SOURCES.txt
--- old/aioresponses-0.7.1/aioresponses.egg-info/SOURCES.txt 2020-10-29
14:51:59.000000000 +0100
+++ new/aioresponses-0.7.3/aioresponses.egg-info/SOURCES.txt 2022-01-10
23:39:36.000000000 +0100
@@ -1,7 +1,6 @@
.coveragerc
.landscape.yml
.pyup.yml
-.travis.yml
AUTHORS
AUTHORS.rst
CONTRIBUTING.rst
@@ -17,14 +16,16 @@
setup.py
tox.ini
unittest.cfg
+.github/workflows/ci.yml
+.github/workflows/flake8.yml
aioresponses/__init__.py
aioresponses/compat.py
aioresponses/core.py
+aioresponses/py.typed
aioresponses.egg-info/PKG-INFO
aioresponses.egg-info/SOURCES.txt
aioresponses.egg-info/dependency_links.txt
aioresponses.egg-info/not-zip-safe
-aioresponses.egg-info/pbr.json
aioresponses.egg-info/requires.txt
aioresponses.egg-info/top_level.txt
docs/Makefile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/aioresponses.egg-info/pbr.json
new/aioresponses-0.7.3/aioresponses.egg-info/pbr.json
--- old/aioresponses-0.7.1/aioresponses.egg-info/pbr.json 2020-10-29
14:51:38.000000000 +0100
+++ new/aioresponses-0.7.3/aioresponses.egg-info/pbr.json 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-{"git_version": "d09592f", "is_release": false}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/setup.cfg
new/aioresponses-0.7.3/setup.cfg
--- old/aioresponses-0.7.1/setup.cfg 2020-10-29 14:51:59.000000000 +0100
+++ new/aioresponses-0.7.3/setup.cfg 2022-01-10 23:39:36.000000000 +0100
@@ -1,10 +1,10 @@
[metadata]
name = aioresponses
author = Pawel Nuckowski
-author-email = [email protected]
+author_email = [email protected]
summary = Mock out requests made by ClientSession from aiohttp package
-description-file = README.rst
-home-page = https://github.com/pnuckowski/aioresponses
+description_file = README.rst
+home_page = https://github.com/pnuckowski/aioresponses
classifier =
Development Status :: 4 - Beta
Intended Audience :: Developers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/tests/test_aioresponses.py
new/aioresponses-0.7.3/tests/test_aioresponses.py
--- old/aioresponses-0.7.1/tests/test_aioresponses.py 2020-10-29
14:49:21.000000000 +0100
+++ new/aioresponses-0.7.3/tests/test_aioresponses.py 2022-01-10
23:36:41.000000000 +0100
@@ -11,6 +11,7 @@
from aiohttp.client import ClientSession
from aiohttp.client_reqrep import ClientResponse
from ddt import ddt, data
+from pkg_resources import parse_version
try:
from aiohttp.errors import (
@@ -117,7 +118,7 @@
self.assertEqual(cm.exception.message, http.RESPONSES[400][0])
@aioresponses()
- @skipIf(condition=AIOHTTP_VERSION < '3.4.0',
+ @skipIf(condition=AIOHTTP_VERSION < parse_version('3.4.0'),
reason='aiohttp<3.4.0 does not support raise_for_status '
'arguments for requests')
async def test_request_raise_for_status(self, m):
@@ -165,6 +166,26 @@
content = await resp.content.read(2)
self.assertEqual(content, b'st')
+ @aioresponses()
+ async def test_binary_body(self, m):
+ body = b'Invalid utf-8: \x95\x00\x85'
+ m.get(self.url, body=body)
+ resp = await self.session.get(self.url)
+ content = await resp.read()
+ self.assertEqual(content, body)
+
+ @aioresponses()
+ async def test_binary_body_via_callback(self, m):
+ body = b'\x00\x01\x02\x80\x81\x82\x83\x84\x85'
+
+ def callback(url, **kwargs):
+ return CallbackResult(body=body)
+
+ m.get(self.url, callback=callback)
+ resp = await self.session.get(self.url)
+ content = await resp.read()
+ self.assertEqual(content, body)
+
async def test_mocking_as_context_manager(self):
with aioresponses() as aiomock:
aiomock.add(self.url, payload={'foo': 'bar'})
@@ -250,6 +271,15 @@
with self.assertRaises(HttpProcessingError):
await self.session.get(url)
+ callback_called = asyncio.Event()
+ url = 'http://example.com/HttpProcessingError'
+ aiomock.get(url, exception=HttpProcessingError(message='foo'),
+ callback=lambda *_, **__: callback_called.set())
+ with self.assertRaises(HttpProcessingError):
+ await self.session.get(url)
+
+ await callback_called.wait()
+
async def test_multiple_requests(self):
"""Ensure that requests are saved the way they would have been sent."""
with aioresponses() as m:
@@ -524,7 +554,7 @@
self.assertEqual(cm.exception.message, http.RESPONSES[400][0])
@aioresponses()
- @skipIf(condition=AIOHTTP_VERSION < '3.4.0',
+ @skipIf(condition=AIOHTTP_VERSION < parse_version('3.4.0'),
reason='aiohttp<3.4.0 does not support raise_for_status '
'arguments for requests')
async def test_do_not_raise_for_status(self, m):
@@ -602,7 +632,7 @@
self.assertEqual(str(response.url), self.url)
@aioresponses()
- @skipIf(condition=AIOHTTP_VERSION < '3.1.0',
+ @skipIf(condition=AIOHTTP_VERSION < parse_version('3.1.0'),
reason='aiohttp<3.1.0 does not add request info on response')
async def test_request_info(self, rsps):
rsps.get(self.url, status=200)
@@ -614,7 +644,7 @@
assert request_info.headers == {}
@aioresponses()
- @skipIf(condition=AIOHTTP_VERSION < '3.1.0',
+ @skipIf(condition=AIOHTTP_VERSION < parse_version('3.1.0'),
reason='aiohttp<3.1.0 does not add request info on response')
async def test_request_info_with_original_request_headers(self, rsps):
headers = {"Authorization": "Bearer access-token"}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/aioresponses-0.7.1/tox.ini
new/aioresponses-0.7.3/tox.ini
--- old/aioresponses-0.7.1/tox.ini 2020-10-29 14:49:21.000000000 +0100
+++ new/aioresponses-0.7.3/tox.ini 2021-10-28 22:55:04.000000000 +0200
@@ -2,10 +2,10 @@
envlist =
flake8,
coverage,
- py36-aiohttp{30,31,32,33,34,35,36,37}
- py37-aiohttp{33,34,35,36,37}
- py38-aiohttp{33,34,35,36,37}
- py39-aiohttp{37}
+ py3.6-aiohttp{30,31,32,33,34,35,36,37}
+ py3.7-aiohttp{33,34,35,36,37}
+ py3.8-aiohttp{33,34,35,36,37}
+ py3.9-aiohttp{37}
skipsdist = True
[testenv:flake8]
@@ -35,7 +35,6 @@
aiohttp35: aiohttp>=3.5,<3.6
aiohttp36: aiohttp>=3.6,<3.7
aiohttp37: aiohttp>=3.7,<3.8
- aiohttp-master: https://github.com/aio-libs/aiohttp/archive/master.tar.gz
-r{toxinidir}/requirements-dev.txt
commands = python -m pytest {posargs}