Skip to content

Commit

Permalink
add event_loop fixture for MockLoop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Aug 15, 2021
1 parent 69e81e8 commit b7503a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/conftest.py
@@ -1,3 +1,4 @@
import asyncio
import ssl
from typing import Dict, Tuple

Expand Down
6 changes: 6 additions & 0 deletions tests/protocols/test_http.py
Expand Up @@ -185,6 +185,12 @@ def get_connected_protocol(app, protocol_cls, event_loop, **kwargs):
asyncio._set_running_loop(None)


@pytest.fixture
def event_loop():
with contextlib.closing(asyncio.new_event_loop()) as loop:
yield loop


@pytest.mark.parametrize("protocol_cls", HTTP_PROTOCOLS)
def test_get_request(protocol_cls, event_loop):
app = Response("Hello, world", media_type="text/plain")
Expand Down

0 comments on commit b7503a5

Please sign in to comment.