1717
1818
1919def test_aiohttp_plugin (testdir : pytest .Testdir ) -> None :
20- testdir .makepyfile (
21- """\
20+ testdir .makepyfile ("""\
2221 import pytest
2322from unittest import mock
2423
@@ -117,16 +116,14 @@ async def test_custom_port_test_server(aiohttp_server, aiohttp_unused_port):
117116 port = aiohttp_unused_port()
118117 server = await aiohttp_server(app, port=port)
119118 assert server.port == port
120- """
121- )
119+ """ )
122120 testdir .makeconftest (CONFTEST )
123121 result = testdir .runpytest ("-p" , "no:sugar" , "--aiohttp-loop=pyloop" )
124122 result .assert_outcomes (passed = 8 )
125123
126124
127125def test_warning_checks (testdir : pytest .Testdir ) -> None :
128- testdir .makepyfile (
129- """\
126+ testdir .makepyfile ("""\
130127
131128async def foobar():
132129 return 123
@@ -137,8 +134,7 @@ async def test_good() -> None:
137134
138135async def test_bad() -> None:
139136 foobar()
140- """
141- )
137+ """ )
142138 testdir .makeconftest (CONFTEST )
143139 result = testdir .runpytest (
144140 "-p" , "no:sugar" , "-s" , "-W" , "default" , "--aiohttp-loop=pyloop"
@@ -155,8 +151,7 @@ async def test_bad() -> None:
155151def test_aiohttp_plugin_async_fixture (
156152 testdir : pytest .Testdir , capsys : pytest .CaptureFixture [str ]
157153) -> None :
158- testdir .makepyfile (
159- """\
154+ testdir .makepyfile ("""\
160155 import pytest
161156
162157from aiohttp import web
@@ -205,8 +200,7 @@ def test_foo_without_loop(foo) -> None:
205200
206201def test_bar(loop, bar) -> None:
207202 assert bar is test_bar
208- """
209- )
203+ """ )
210204 testdir .makeconftest (CONFTEST )
211205 result = testdir .runpytest ("-p" , "no:sugar" , "--aiohttp-loop=pyloop" )
212206 result .assert_outcomes (passed = 3 , errors = 1 )
@@ -217,8 +211,7 @@ def test_bar(loop, bar) -> None:
217211
218212
219213def test_aiohttp_plugin_async_gen_fixture (testdir : pytest .Testdir ) -> None :
220- testdir .makepyfile (
221- """\
214+ testdir .makepyfile ("""\
222215 import pytest
223216from unittest import mock
224217
@@ -251,8 +244,7 @@ async def test_hello(cli) -> None:
251244
252245def test_finalized() -> None:
253246 assert canary.called is True
254- """
255- )
247+ """ )
256248 testdir .makeconftest (CONFTEST )
257249 result = testdir .runpytest ("-p" , "no:sugar" , "--aiohttp-loop=pyloop" )
258250 result .assert_outcomes (passed = 2 )
@@ -268,8 +260,7 @@ def test_warnings_propagated(recwarn: pytest.WarningsRecorder) -> None:
268260
269261
270262def test_aiohttp_client_cls_fixture_custom_client_used (testdir : pytest .Testdir ) -> None :
271- testdir .makepyfile (
272- """
263+ testdir .makepyfile ("""
273264import pytest
274265from aiohttp.web import Application
275266from aiohttp.test_utils import TestClient
@@ -288,26 +279,21 @@ async def test_hello(aiohttp_client) -> None:
288279 client = await aiohttp_client(Application())
289280 assert isinstance(client, CustomClient)
290281
291- """
292- )
282+ """ )
293283 testdir .makeconftest (CONFTEST )
294284 result = testdir .runpytest ()
295285 result .assert_outcomes (passed = 1 )
296286
297287
298288def test_aiohttp_client_cls_fixture_factory (testdir : pytest .Testdir ) -> None :
299- testdir .makeconftest (
300- CONFTEST
301- + """
289+ testdir .makeconftest (CONFTEST + """
302290
303291def pytest_configure(config):
304292 config.addinivalue_line("markers", "rest: RESTful API tests")
305293 config.addinivalue_line("markers", "graphql: GraphQL API tests")
306294
307- """
308- )
309- testdir .makepyfile (
310- """
295+ """ )
296+ testdir .makepyfile ("""
311297import pytest
312298from aiohttp.web import Application
313299from aiohttp.test_utils import TestClient
@@ -341,7 +327,6 @@ async def test_graphql(aiohttp_client) -> None:
341327 client = await aiohttp_client(Application())
342328 assert isinstance(client, GraphQLClient)
343329
344- """
345- )
330+ """ )
346331 result = testdir .runpytest ()
347332 result .assert_outcomes (passed = 2 )
0 commit comments