-
-
Notifications
You must be signed in to change notification settings - Fork 113
Add events task #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add events task #76
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,7 +39,7 @@ async def _close(self): | |
| # (see https://github.com/KeepSafe/aiohttp/issues/739) | ||
|
|
||
| # response error , it has been closed | ||
| await self._response.close() | ||
| self._response.close() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you forget
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No I actually fixed it. This is no coroutine apparently and the try...except...pass on the top level was hiding the exception. Commit message: 1d3abd8 |
||
|
|
||
|
|
||
| async def json_stream_result(response, transform=None, stream=True): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import asyncio | ||
|
|
||
| import pytest | ||
|
|
||
|
|
||
| def test_events_default_task(docker): | ||
| loop = asyncio.get_event_loop() | ||
| docker.events.subscribe() | ||
| assert docker.events.task is not None | ||
| loop.run_until_complete(docker.events.stop()) | ||
| assert docker.events.task.done() | ||
| assert docker.events.json_stream is None | ||
|
|
||
|
|
||
| def test_events_provided_task(docker): | ||
| loop = asyncio.get_event_loop() | ||
| task = asyncio.ensure_future(docker.events.run()) | ||
| docker.events.subscribe(create_task=False) | ||
| assert docker.events.task is None | ||
| loop.run_until_complete(docker.events.stop()) | ||
| assert docker.events.json_stream is None | ||
| task.cancel() | ||
| with pytest.raises(asyncio.CancelledError): | ||
| loop.run_until_complete(task) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@barrachri the error in the
close()used to be hidden by this try...except: passThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, it seems harmless, I'll check this
.close()in the future PRs.