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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.15
rev: v0.15.16
hooks:
- id: ruff-check
types: [file]
Expand All @@ -38,7 +38,7 @@ repos:
# tomli needed on 3.10. tomllib is available in stdlib on 3.11+
- tomli
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.47.0
rev: v1.47.2
hooks:
- id: typos
- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand Down Expand Up @@ -73,7 +73,7 @@ repos:
additional_dependencies: ["pyyaml"]
files: ^(test-requirements\.txt)|(\.pre-commit-config\.yaml)$
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.11.17
rev: 0.11.19
hooks:
# Compile requirements
- id: pip-compile
Expand Down
8 changes: 5 additions & 3 deletions src/trio/_core/_tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def test_asyncgen_basics() -> None:
async def example(cause: str) -> AsyncGenerator[int, None]:
try:
with contextlib.suppress(GeneratorExit):
yield 42
# we *want* to test what happens to delayed `await`
yield 42 # noqa: ASYNC119
await _core.checkpoint()
except _core.Cancelled:
assert "exhausted" not in cause
Expand Down Expand Up @@ -277,14 +278,15 @@ async def test_fallback_when_no_hook_claims_it(
async def well_behaved() -> AsyncGenerator[int, None]:
yield 42

# noqas because we *want* to test delayed yield/await!
async def yields_after_yield() -> AsyncGenerator[int, None]:
with pytest.raises(GeneratorExit):
yield 42
yield 42 # noqa: ASYNC119
yield 100

async def awaits_after_yield() -> AsyncGenerator[int, None]:
with pytest.raises(GeneratorExit):
yield 42
yield 42 # noqa: ASYNC119
await _core.cancel_shielded_checkpoint()

with restore_unraisablehook():
Expand Down
8 changes: 4 additions & 4 deletions src/trio/_tests/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ async def agen() -> AsyncGenerator[None]:
yield
with trio.CancelScope() as cscope:
cscope.cancel()
yield
yield # noqa: ASYNC119 # https://github.com/astral-sh/ruff/issues/25770

with pytest.raises(AssertionError):
async with agen() as recv_chan:
Expand Down Expand Up @@ -636,7 +636,7 @@ async def test_as_safe_channel_genexit_exception_group() -> None:
async def agen() -> AsyncGenerator[None]:
try:
async with trio.open_nursery():
yield
yield # noqa: ASYNC119 # https://github.com/astral-sh/ruff/issues/25770
except BaseException as e:
assert pytest.RaisesGroup(GeneratorExit).matches(e) # noqa: PT017
raise
Expand Down Expand Up @@ -668,7 +668,7 @@ async def wait_then_raise() -> None:
async def agen() -> AsyncGenerator[None]:
async with trio.open_nursery() as nursery:
nursery.start_soon(wait_then_raise)
yield
yield # noqa: ASYNC119 # https://github.com/astral-sh/ruff/issues/25770

with pytest.RaisesGroup(ValueError):
async with agen() as g:
Expand All @@ -688,7 +688,7 @@ async def agen(ex: type[BaseException]) -> AsyncGenerator[None]:
async with trio.open_nursery() as nursery:
nursery.start_soon(wait_then_raise, ex)
nursery.start_soon(wait_then_raise, GeneratorExit)
yield
yield # noqa: ASYNC119 # https://github.com/astral-sh/ruff/issues/25770

with pytest.RaisesGroup(AssertionError):
async with agen(GeneratorExit) as g:
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ requests==2.34.2
# via sphinx
roman-numerals==4.1.0 ; python_full_version >= '3.11'
# via sphinx
ruff==0.15.15
ruff==0.15.16
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand Down Expand Up @@ -205,7 +205,7 @@ typing-extensions==4.15.0
# virtualenv
urllib3==2.7.0
# via requests
uv==0.11.17
uv==0.11.19
# via -r test-requirements.in
virtualenv==21.4.2
# via pre-commit
Loading