Code cleanup

This commit is contained in:
Julien Duponchelle committed 2016-02-05 10:07:13 +01:00
1 parent 5bee927481
commit 373113545f
5 files changed
+34 -35

No files matched your search

+4 -4
View File
@@ -61,20 +61,20 @@ class Query:
body = json.dumps(body)
@asyncio.coroutine
def go(future):
def go_request(future):
response = yield from aiohttp.request(method, self.get_url(path, api_version), data=body)
future.set_result(response)
future = asyncio.Future()
asyncio.async(go(future))
asyncio.async(go_request(future))
self._loop.run_until_complete(future)
response = future.result()
@asyncio.coroutine
def go(future, response):
def go_read(future, response):
response = yield from response.read()
future.set_result(response)
future = asyncio.Future()
asyncio.async(go(future, response))
asyncio.async(go_read(future, response))
self._loop.run_until_complete(future)
response.body = future.result()
x_route = response.headers.get('X-Route', None)
+2 -1
View File
@@ -42,7 +42,7 @@ def test_reserve_tcp_port_outside_range():
assert mock_emit.call_args[0][0] == "log.warning"
def test_reserve_tcp_port_already_used():
def test_reserve_tcp_port_already_used_by_another_program():
"""
This test simulate a scenario where the port is already taken
by another programm on the server
@@ -65,6 +65,7 @@ def test_reserve_tcp_port_already_used():
assert port != 2001
assert mock_emit.call_args[0][0] == "log.warning"
def test_reserve_tcp_port_already_used():
"""
This test simulate a scenario where the port is already taken