Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,15 @@ jobs:
COLOR: yes
AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }}
run: >- # `exit 1` makes sure that the job remains red with flaky runs
pytest --no-cov -vvvvv --lf && exit 1
pytest --no-cov --numprocesses=0 -vvvvv --lf && exit 1
shell: bash
- name: Run dev_mode tests
env:
COLOR: yes
AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }}
PIP_USER: 1
run: python -X dev -m pytest -m dev_mode --cov-append
PYTHONDEVMODE: 1
run: pytest -m dev_mode --cov-append --numprocesses=0
shell: bash
- name: Turn coverage into xml
env:
Expand Down Expand Up @@ -292,7 +293,7 @@ jobs:
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: python -Im pytest --no-cov -vvvvv --codspeed
run: python -Im pytest --no-cov --numprocesses=0 -vvvvv --codspeed


check: # This job does nothing and is only used for the branch protection
Expand Down
19 changes: 19 additions & 0 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ alabaster==0.7.13
# via sphinx
annotated-types==0.7.0
# via pydantic
apipkg==1.5
# via execnet
async-timeout==4.0.3 ; python_version < "3.11"
# via
# -r requirements/runtime-deps.in
Expand Down Expand Up @@ -69,6 +71,8 @@ filelock==3.16.1
# via
# pytest-codspeed
# virtualenv
execnet==2.1.1
# via pytest-xdist
freezegun==1.5.1
# via
# -r requirements/lint.in
Expand Down Expand Up @@ -145,6 +149,8 @@ proxy-py==2.4.9
# via
# -r requirements/lint.in
# -r requirements/test.in
py==1.11.0
# via pytest
pycares==4.4.0
# via aiodns
pycparser==2.22
Expand Down Expand Up @@ -174,12 +180,25 @@ pytest==8.1.1
# pytest-codspeed
# pytest-cov
# pytest-mock
# pytest-xdist
pytest-codspeed==3.0.0
# via
# -r requirements/lint.in
# -r requirements/test.in
pytest-cov==5.0.0
# via -r requirements/test.in
pytest-mock==3.14.0
# via -r requirements/test.in
pytest-xdist==3.6.1
# via -r requirements/test.txt
python-dateutil==2.8.2
# via freezegun
python-on-whales==0.71.0
# via
# -r requirements/lint.in
# -r requirements/test.in
pytest-cov==5.0.0
# via -r requirements/test.in
pytest-mock==3.14.0
# via
# -r requirements/lint.in
Expand Down
3 changes: 2 additions & 1 deletion requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
coverage
freezegun
mypy; implementation_name == "cpython"
proxy.py >= 2.4.4rc4
proxy.py >= 2.4.4rc5
pytest
pytest-cov
pytest-mock
pytest-xdist
pytest_codspeed
python-on-whales
setuptools-git
Expand Down
10 changes: 9 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ cryptography==43.0.3
# via trustme
exceptiongroup==1.2.2
# via pytest
execnet==2.1.1
# via pytest-xdist
filelock==3.16.1
# via pytest-codspeed
freezegun==1.5.1
Expand Down Expand Up @@ -78,6 +80,8 @@ propcache==0.2.0
# yarl
proxy-py==2.4.9
# via -r requirements/test.in
py==1.11.0
# via pytest
pycares==4.4.0
# via aiodns
pycparser==2.22
Expand All @@ -95,11 +99,15 @@ pytest==8.1.1
# pytest-cov
# pytest-mock
pytest-codspeed==3.0.0
# via -r requirements/test.in
# via
# -r requirements/test.in
# pytest-xdist
pytest-cov==5.0.0
# via -r requirements/test.in
pytest-mock==3.14.0
# via -r requirements/test.in
pytest-xdist==3.6.1
# via -r requirements/test.in
python-dateutil==2.9.0.post0
# via freezegun
python-on-whales==0.73.0
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ exclude_lines =

[tool:pytest]
addopts =
# `pytest-xdist`:
--numprocesses=auto

# show 10 slowest invocations:
--durations=10

Expand Down
26 changes: 14 additions & 12 deletions tests/test_client_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,8 @@ async def test_urlencoded_formdata_charset(
data=aiohttp.FormData({"hey": "you"}, charset="koi8-r"),
loop=loop,
)
await req.send(conn)
async with await req.send(conn):
await asyncio.sleep(0)
assert "application/x-www-form-urlencoded; charset=koi8-r" == req.headers.get(
"CONTENT-TYPE"
)
Expand All @@ -755,7 +756,8 @@ async def test_formdata_boundary_from_headers(
headers={"Content-Type": f"multipart/form-data; boundary={boundary}"},
loop=loop,
)
await req.send(conn)
async with await req.send(conn):
await asyncio.sleep(0)
assert req.body._boundary == boundary.encode()


Expand Down Expand Up @@ -1088,13 +1090,13 @@ async def throw_exc() -> None:

t = loop.create_task(throw_exc())

await req.send(conn)
assert req._writer is not None
await req._writer
await t
# assert conn.close.called
assert conn.protocol is not None
assert conn.protocol.set_exception.called
async with await req.send(conn):
assert req._writer is not None
await req._writer
await t
# assert conn.close.called
assert conn.protocol is not None
assert conn.protocol.set_exception.called
await req.close()


Expand All @@ -1118,9 +1120,9 @@ async def throw_exc() -> None:

t = loop.create_task(throw_exc())

await req.send(conn)
assert req._writer is not None
await req._writer
async with await req.send(conn):
assert req._writer is not None
await req._writer
await t
# assert conn.close.called
assert conn.protocol.set_exception.called
Expand Down
Loading