From 6c41b8b723497f8736bf1b96003d650ee5feb078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steinn=20Eldj=C3=A1rn=20Sigur=C3=B0arson?= Date: Fri, 28 Jun 2019 13:30:14 +0000 Subject: [PATCH] Use built-in helpers to avoid use of async keywords which cause syntax errors on 2.x --- tests/integration/test_aiohttp.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/integration/test_aiohttp.py b/tests/integration/test_aiohttp.py index c2145af..58b9a62 100644 --- a/tests/integration/test_aiohttp.py +++ b/tests/integration/test_aiohttp.py @@ -93,20 +93,15 @@ def test_binary(tmpdir, scheme): assert cassette.play_count == 1 -@pytest.mark.asyncio -async def test_stream(tmpdir, scheme): +def test_stream(tmpdir, scheme): url = scheme + '://httpbin.org/get' headers = {'Content-Type': 'application/json'} with vcr.use_cassette(str(tmpdir.join('stream.yaml'))): - async with aiohttp.ClientSession() as session: - resp = await session.get(url, headers=headers) - body = await resp.read() # do not use stream interface here, the stream seems exhausted by vcr + resp, body = get(url, output='raw') # XXX: headers? with vcr.use_cassette(str(tmpdir.join('stream.yaml'))) as cassette: - async with aiohttp.ClientSession() as session: - cassette_resp = await session.get(url, headers=headers) - cassette_body = await cassette_resp.content.read() + cassette_resp, cassette_body = get(url, output='raw') assert cassette_body == body assert cassette.play_count == 1