Skip to content

Commit

Permalink
Fix #1203: Create CookieJar without explicit loop passing
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Sep 21, 2016
1 parent 0c8b3ef commit 88f7ed8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CHANGES

- Add missing `WSMsgType` to `web_ws.__all__`, see #1200

-
- Fix `CookieJar` ctor when called with `loop=None` #1203

-

Expand Down
2 changes: 1 addition & 1 deletion aiohttp/cookiejar.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, *, unsafe=False, loop=None):
self._cookies = defaultdict(SimpleCookie)
self._host_only_cookies = set()
self._unsafe = unsafe
self._next_expiration = ceil(loop.time())
self._next_expiration = ceil(self._loop.time())
self._expirations = {}

def clear(self):
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cookiejar.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ def test_constructor(loop, cookies_to_send, cookies_to_receive):
assert jar._loop is loop


def test_ctor_ith_default_loop(loop):
asyncio.set_event_loop(loop)
jar = CookieJar()
assert jar._loop is loop


def test_domain_filter_ip_cookie_send(loop):
jar = CookieJar(loop=loop)
cookies = SimpleCookie(
Expand Down

0 comments on commit 88f7ed8

Please sign in to comment.