Skip to content

Commit

Permalink
Merge pull request #239 from kalaspuff/feature/dependency-udates
Browse files Browse the repository at this point in the history
Updated dependencies and added more strict versioning requirements
  • Loading branch information
kalaspuff authored Nov 15, 2017
2 parents 06b352e + 68ef0f1 commit 947b3d7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
aioamqp==0.10.0
aiobotocore==0.4.5
aiohttp==2.2.5
aiobotocore==0.5.1
aiohttp==2.3.2
async-timeout==2.0.0
botocore==1.7.5
botocore==1.7.40
chardet==3.0.4
codecov==2.0.9
coverage==4.4.2
Expand All @@ -23,4 +23,4 @@ six==1.11.0
tzlocal==1.4
ujson==1.35
uvloop==0.8.1
yarl==0.13.0
yarl==0.14.2
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import tomodachi.__version__

install_requires = [
'aioamqp>=0.10.0',
'aioamqp>=0.10.0, <0.11.0',
'ujson>=1.35',
'uvloop>=0.8.0',
'aiobotocore>=0.3.1',
'uvloop>=0.8.1',
'aiobotocore>=0.5.1, <0.6.0',
'tzlocal>=1.4',
'aiohttp<=2.2.5'
'aiohttp==2.3.2, <2.4.0'
]

PY_VER = sys.version_info
Expand Down
20 changes: 16 additions & 4 deletions tests/test_http_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,27 @@ async def _async(loop: Any) -> None:
await client.get('http://127.0.0.1:{}/test'.format(port))
with open(log_path) as file:
content = file.read()
assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content
assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' not in content
assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content
assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' not in content

async with aiohttp.ClientSession(loop=loop) as client:
await client.get('http://127.0.0.1:{}/404'.format(port))
with open(log_path) as file:
content = file.read()
assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 0' in content
assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 0' in content
assert '[http] [200] 127.0.0.1 - "GET /test HTTP/1.1" 4 -' in content
assert '[http] [404] 127.0.0.1 - "GET /404 HTTP/1.1" 8 -' in content

async with aiohttp.ClientSession(loop=loop) as client:
await client.post('http://127.0.0.1:{}/zero-post'.format(port), data=b'')
with open(log_path) as file:
content = file.read()
assert '[http] [404] 127.0.0.1 - "POST /zero-post HTTP/1.1" 8 0' in content

async with aiohttp.ClientSession(loop=loop) as client:
await client.post('http://127.0.0.1:{}/post'.format(port), data=b'RANDOMDATA')
with open(log_path) as file:
content = file.read()
assert '[http] [404] 127.0.0.1 - "POST /post HTTP/1.1" 8 10' in content

with open(log_path) as file:
content = file.read()
Expand Down
10 changes: 5 additions & 5 deletions tomodachi/transport/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ def __call__(self) -> RequestHandler:


class DynamicResource(web_urldispatcher.DynamicResource):
def __init__(self, pattern: Any, formatter: str, *, name: Optional[str]=None) -> None:
super().__init__(re.compile('\\/'), '/', name=name)
def __init__(self, pattern: Any, *, name: Optional[str]=None) -> None:
self._routes = [] # type: List
self._name = name
self._pattern = pattern
self._formatter = formatter
self._formatter = ''


class UrlDispatcher(web_urldispatcher.UrlDispatcher):
Expand All @@ -110,8 +111,7 @@ def add_pattern_route(self, method: str, pattern: str, handler: Callable, *, nam
except re.error as exc:
raise ValueError(
"Bad pattern '{}': {}".format(pattern, exc)) from None
formatter = ''
resource = DynamicResource(compiled_pattern, formatter, name=name)
resource = DynamicResource(compiled_pattern, name=name)
self.register_resource(resource)
if method == 'GET':
resource.add_route('HEAD', handler, expect_handler=expect_handler)
Expand Down

0 comments on commit 947b3d7

Please sign in to comment.