Skip to content

Commit

Permalink
rename aiohttp version variable
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuckowski committed Sep 27, 2018
1 parent 64a2898 commit 386e68b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions aioresponses/compat.py
Expand Up @@ -4,7 +4,7 @@
from typing import Union, Dict # noqa
from urllib.parse import urlencode, parse_qsl

from aiohttp import __version__ as __aioversion__, StreamReader
from aiohttp import __version__ as aiohttp_version, StreamReader
from multidict import MultiDict
from yarl import URL

Expand All @@ -14,9 +14,9 @@
# Python 3.7
Pattern = re.Pattern

VERSION = StrictVersion(__aioversion__)
AIOHTTP_VERSION = StrictVersion(aiohttp_version)

if VERSION >= StrictVersion('3.0.0'):
if AIOHTTP_VERSION >= StrictVersion('3.0.0'):
from aiohttp.client_proto import ResponseHandler

def stream_reader_factory():
Expand Down Expand Up @@ -48,7 +48,7 @@ def normalize_url(url: 'Union[URL, str]') -> 'URL':
__all__ = [
'URL',
'Pattern',
'VERSION',
'AIOHTTP_VERSION',
'merge_params',
'stream_reader_factory',
'normalize_url',
Expand Down
8 changes: 4 additions & 4 deletions aioresponses/core.py
Expand Up @@ -17,7 +17,7 @@
stream_reader_factory,
merge_params,
normalize_url,
VERSION
AIOHTTP_VERSION
)


Expand Down Expand Up @@ -74,15 +74,15 @@ async def build_response(
if isinstance(self.exception, Exception):
return self.exception
kwargs = {}
if VERSION >= StrictVersion('3.1.0'):
if AIOHTTP_VERSION >= StrictVersion('3.1.0'):
loop = Mock()
loop.get_debug = Mock()
loop.get_debug.return_value = True
kwargs['request_info'] = Mock()
kwargs['writer'] = Mock()
kwargs['continue100'] = None
kwargs['timer'] = TimerNoop()
if VERSION >= StrictVersion('3.3.0'):
if AIOHTTP_VERSION >= StrictVersion('3.3.0'):
pass
else:
kwargs['auto_decompress'] = True
Expand All @@ -95,7 +95,7 @@ async def build_response(
if self.headers:
headers.update(self.headers)
raw_headers = self._build_raw_headers(headers)
if VERSION >= StrictVersion('3.3.0'):
if AIOHTTP_VERSION >= StrictVersion('3.3.0'):
# Reified attributes
self.resp._headers = headers
self.resp._raw_headers = raw_headers
Expand Down
7 changes: 3 additions & 4 deletions tests/test_aioresponses.py
@@ -1,24 +1,23 @@
# -*- coding: utf-8 -*-
import asyncio
import re
from typing import Coroutine, Generator, Union
from unittest.mock import patch

from aiohttp import hdrs
from aiohttp.client import ClientSession
from aiohttp.client_reqrep import ClientResponse
from asynctest import fail_on
from asynctest.case import TestCase
from typing import Coroutine, Generator, Union

from aioresponses.compat import URL
from ddt import ddt, data

try:
from aiohttp.errors import ClientConnectionError, HttpProcessingError
except ImportError:
from aiohttp.client_exceptions import ClientConnectionError
from aiohttp.http_exceptions import HttpProcessingError
from ddt import ddt, data

from aioresponses.compat import URL
from aioresponses import aioresponses


Expand Down
2 changes: 1 addition & 1 deletion tests/test_compat.py
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from typing import Union
from unittest import TestCase

from ddt import ddt, data
from typing import Union
from yarl import URL

from aioresponses.compat import merge_params
Expand Down

0 comments on commit 386e68b

Please sign in to comment.