Skip to content

Commit 9dcc8b7

Browse files
committed
Handle ruff changes
1 parent 4a81e52 commit 9dcc8b7

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

src/trio/_core/_tests/test_asyncgen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async def example(cause: str) -> AsyncGenerator[int, None]:
4242

4343
async def async_main() -> None:
4444
# GC'ed before exhausted
45-
with pytest.warns(
45+
with pytest.warns( # noqa: PT031
4646
ResourceWarning,
4747
match="Async generator.*collected before.*exhausted",
4848
):

src/trio/_core/_tests/test_guest_mode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@ async def abandoned_main(in_host: InHost) -> None:
418418
with pytest.raises(ZeroDivisionError):
419419
trivial_guest_run(abandoned_main)
420420

421-
with pytest.warns(RuntimeWarning, match="Trio guest run got abandoned"):
421+
with pytest.warns( # noqa: PT031
422+
RuntimeWarning,
423+
match="Trio guest run got abandoned",
424+
):
422425
do_abandoned_guest_run()
423426
gc_collect_harder()
424427

src/trio/_tests/test_deprecate.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ def test_warning_class() -> None:
270270
warn_deprecated("foo", "bar", issue=None, instead=None)
271271

272272
# essentially the same as the above check
273-
with pytest.warns(DeprecationWarning):
273+
with pytest.warns(
274+
DeprecationWarning,
275+
match="^foo is deprecated since Trio bar with no replacement$",
276+
):
274277
warn_deprecated("foo", "bar", issue=None, instead=None)
275278

276279
with pytest.warns(TrioDeprecationWarning):

src/trio/_tests/test_dtls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ async def start_and_forget_endpoint() -> int:
749749
during_tasks = trio.lowlevel.current_statistics().tasks_living
750750
return during_tasks
751751

752-
with pytest.warns(ResourceWarning):
752+
with pytest.warns(ResourceWarning): # noqa: PT031
753753
during_tasks = await start_and_forget_endpoint()
754754
await trio.testing.wait_all_tasks_blocked()
755755
gc_collect_harder()
@@ -765,7 +765,7 @@ async def start_and_forget_endpoint() -> int:
765765
async def test_gc_before_system_task_starts() -> None:
766766
e = endpoint()
767767

768-
with pytest.warns(ResourceWarning):
768+
with pytest.warns(ResourceWarning): # noqa: PT031
769769
del e
770770
gc_collect_harder()
771771

@@ -788,7 +788,7 @@ async def test_gc_as_packet_received() -> None:
788788
# At this point, the endpoint's receive loop has been marked runnable because it
789789
# just received a packet; closing the endpoint socket won't interrupt that. But by
790790
# the time it wakes up to process the packet, the endpoint will be gone.
791-
with pytest.warns(ResourceWarning):
791+
with pytest.warns(ResourceWarning): # noqa: PT031
792792
del e
793793
gc_collect_harder()
794794

@@ -805,7 +805,7 @@ async def main() -> DTLSEndpoint:
805805
return endpoint()
806806

807807
e = trio.run(main)
808-
with pytest.warns(ResourceWarning):
808+
with pytest.warns(ResourceWarning): # noqa: PT031
809809
del e
810810
gc_collect_harder()
811811

src/trio/_tests/test_subprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def broken_terminate(self: Process) -> NoReturn:
676676

677677
monkeypatch.setattr(Process, "terminate", broken_terminate)
678678

679-
with pytest.warns(RuntimeWarning, match=".*whoops.*"):
679+
with pytest.warns(RuntimeWarning, match=".*whoops.*"): # noqa: PT031
680680
async with _core.open_nursery() as nursery:
681681
nursery.start_soon(run_process, SLEEP(9999))
682682
await wait_all_tasks_blocked()
@@ -690,7 +690,7 @@ async def test_warn_on_cancel_SIGKILL_escalation(
690690
) -> None:
691691
monkeypatch.setattr(Process, "terminate", lambda *args: None)
692692

693-
with pytest.warns(RuntimeWarning, match=".*ignored SIGTERM.*"):
693+
with pytest.warns(RuntimeWarning, match=".*ignored SIGTERM.*"): # noqa: PT031
694694
async with _core.open_nursery() as nursery:
695695
nursery.start_soon(run_process, SLEEP(9999))
696696
await wait_all_tasks_blocked()

0 commit comments

Comments
 (0)