Skip to content

Commit a618a87

Browse files
[pre-commit.ci] pre-commit autoupdate (aio-libs#11757)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 24cb8c9 commit a618a87

9 files changed

Lines changed: 35 additions & 65 deletions

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ repos:
6060
- flake8-no-implicit-concat==0.3.4
6161
- flake8-requirements==1.7.8
6262
- repo: https://github.com/PyCQA/isort
63-
rev: '7.0.0'
63+
rev: '8.0.1'
6464
hooks:
6565
- id: isort
6666
- repo: https://github.com/psf/black-pre-commit-mirror
67-
rev: '25.9.0'
67+
rev: '26.3.1'
6868
hooks:
6969
- id: black
7070
language_version: python3 # Should be a command that runs python
@@ -99,7 +99,7 @@ repos:
9999
- id: detect-private-key
100100
exclude: ^examples/
101101
- repo: https://github.com/asottile/pyupgrade
102-
rev: 'v3.21.0'
102+
rev: 'v3.21.2'
103103
hooks:
104104
- id: pyupgrade
105105
args: ['--py37-plus']
@@ -121,7 +121,7 @@ repos:
121121
exclude: >-
122122
^CHANGES\.rst$
123123
- repo: https://github.com/codespell-project/codespell
124-
rev: v2.4.1
124+
rev: v2.4.2
125125
hooks:
126126
- id: codespell
127127
additional_dependencies:

examples/background_tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22
"""Example of aiohttp.web.Application.on_startup signal handler"""
3+
34
import asyncio
45
from collections.abc import AsyncIterator
56
from contextlib import asynccontextmanager, suppress

examples/web_srv.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77

88

99
async def intro(request: web.Request) -> web.StreamResponse:
10-
txt = textwrap.dedent(
11-
"""\
10+
txt = textwrap.dedent("""\
1211
Type {url}/hello/John {url}/simple or {url}/change_body
1312
in browser url bar
14-
"""
15-
).format(url="127.0.0.1:8080")
13+
""").format(url="127.0.0.1:8080")
1614
binary = txt.encode("utf8")
1715
resp = web.StreamResponse()
1816
resp.content_length = len(binary)

examples/web_srv_route_deco.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010

1111
@routes.get("/")
1212
async def intro(request: web.Request) -> web.StreamResponse:
13-
txt = textwrap.dedent(
14-
"""\
13+
txt = textwrap.dedent("""\
1514
Type {url}/hello/John {url}/simple or {url}/change_body
1615
in browser url bar
17-
"""
18-
).format(url="127.0.0.1:8080")
16+
""").format(url="127.0.0.1:8080")
1917
binary = txt.encode("utf8")
2018
resp = web.StreamResponse()
2119
resp.content_length = len(binary)

examples/web_srv_route_table.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77

88

99
async def intro(request: web.Request) -> web.StreamResponse:
10-
txt = textwrap.dedent(
11-
"""\
10+
txt = textwrap.dedent("""\
1211
Type {url}/hello/John {url}/simple or {url}/change_body
1312
in browser url bar
14-
"""
15-
).format(url="127.0.0.1:8080")
13+
""").format(url="127.0.0.1:8080")
1614
binary = txt.encode("utf8")
1715
resp = web.StreamResponse()
1816
resp.content_length = len(binary)

tests/test_http_parser.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,10 @@ def test_invalid_character(
165165
max_field_size=8190,
166166
)
167167
text = b"POST / HTTP/1.1\r\nHost: localhost:8080\r\nSet-Cookie: abc\x01def\r\n\r\n"
168-
error_detail = re.escape(
169-
r""":
168+
error_detail = re.escape(r""":
170169
171170
b'Set-Cookie: abc\x01def'
172-
^"""
173-
)
171+
^""")
174172
with pytest.raises(http_exceptions.BadHttpMessage, match=error_detail):
175173
parser.feed_data(text)
176174

@@ -189,12 +187,10 @@ def test_invalid_linebreak(
189187
max_field_size=8190,
190188
)
191189
text = b"GET /world HTTP/1.1\r\nHost: 127.0.0.1\n\r\n"
192-
error_detail = re.escape(
193-
r""":
190+
error_detail = re.escape(r""":
194191
195192
b'Host: 127.0.0.1\n'
196-
^"""
197-
)
193+
^""")
198194
with pytest.raises(http_exceptions.BadHttpMessage, match=error_detail):
199195
parser.feed_data(text)
200196

tests/test_imports.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,18 @@
88

99
def test___all__(pytester: pytest.Pytester) -> None:
1010
"""See https://github.com/aio-libs/aiohttp/issues/6197"""
11-
pytester.makepyfile(
12-
test_a="""
11+
pytester.makepyfile(test_a="""
1312
from aiohttp import *
1413
assert 'GunicornWebWorker' in globals()
15-
"""
16-
)
14+
""")
1715
result = pytester.runpytest("-vv")
1816
result.assert_outcomes(passed=0, errors=0)
1917

2018

2119
def test_web___all__(pytester: pytest.Pytester) -> None:
22-
pytester.makepyfile(
23-
test_b="""
20+
pytester.makepyfile(test_b="""
2421
from aiohttp.web import *
25-
"""
26-
)
22+
""")
2723
result = pytester.runpytest("-vv")
2824
result.assert_outcomes(passed=0, errors=0)
2925

tests/test_pytest_plugin.py

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717

1818

1919
def test_aiohttp_plugin(testdir: pytest.Testdir) -> None:
20-
testdir.makepyfile(
21-
"""\
20+
testdir.makepyfile("""\
2221
import pytest
2322
from 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

127125
def test_warning_checks(testdir: pytest.Testdir) -> None:
128-
testdir.makepyfile(
129-
"""\
126+
testdir.makepyfile("""\
130127
131128
async def foobar():
132129
return 123
@@ -137,8 +134,7 @@ async def test_good() -> None:
137134
138135
async 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:
155151
def 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
162157
from aiohttp import web
@@ -205,8 +200,7 @@ def test_foo_without_loop(foo) -> None:
205200
206201
def 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

219213
def test_aiohttp_plugin_async_gen_fixture(testdir: pytest.Testdir) -> None:
220-
testdir.makepyfile(
221-
"""\
214+
testdir.makepyfile("""\
222215
import pytest
223216
from unittest import mock
224217
@@ -251,8 +244,7 @@ async def test_hello(cli) -> None:
251244
252245
def 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

270262
def test_aiohttp_client_cls_fixture_custom_client_used(testdir: pytest.Testdir) -> None:
271-
testdir.makepyfile(
272-
"""
263+
testdir.makepyfile("""
273264
import pytest
274265
from aiohttp.web import Application
275266
from 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

298288
def test_aiohttp_client_cls_fixture_factory(testdir: pytest.Testdir) -> None:
299-
testdir.makeconftest(
300-
CONFTEST
301-
+ """
289+
testdir.makeconftest(CONFTEST + """
302290
303291
def 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("""
311297
import pytest
312298
from aiohttp.web import Application
313299
from 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)

tests/test_test_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,14 @@ async def test_server_make_url_yarl_compatibility(
302302
def test_testcase_no_app(
303303
testdir: pytest.Testdir, loop: asyncio.AbstractEventLoop
304304
) -> None:
305-
testdir.makepyfile(
306-
"""
305+
testdir.makepyfile("""
307306
from aiohttp.test_utils import AioHTTPTestCase
308307
309308
310309
class InvalidTestCase(AioHTTPTestCase):
311310
def test_noop(self) -> None:
312311
pass
313-
"""
314-
)
312+
""")
315313
result = testdir.runpytest()
316314
result.stdout.fnmatch_lines(["*TypeError*"])
317315

0 commit comments

Comments
 (0)