Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #3189

Merged
merged 4 commits into from
Jan 21, 2025
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
2 changes: 2 additions & 0 deletions .github/workflows/check-newsfragment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Check newsfragment

permissions: {}

on:
pull_request:
types: [labeled, unlabeled, opened, synchronize]
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: CI

permissions: {}

on:
push:
branches-ignore:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ on:
tags:
- v*

permissions: {}

# a lot of code taken from https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
jobs:
build:
Expand Down
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.9.1
rev: v0.9.2
hooks:
- id: ruff
types: [file]
Expand All @@ -43,7 +43,7 @@ repos:
hooks:
- id: sphinx-lint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.1.1
rev: v1.2.2
hooks:
- id: zizmor
- repo: local
Expand All @@ -56,7 +56,7 @@ repos:
additional_dependencies: ["astor", "attrs", "black", "ruff"]
files: ^src\/trio\/_core\/(_run|(_i(o_(common|epoll|kqueue|windows)|nstrumentation)))\.py$
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.18
rev: 0.5.21
hooks:
# Compile requirements
- id: pip-compile
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_core/_tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def example(cause: str) -> AsyncGenerator[int, None]:

async def async_main() -> None:
# GC'ed before exhausted
with pytest.warns(
with pytest.warns( # noqa: PT031
ResourceWarning,
match="Async generator.*collected before.*exhausted",
):
Expand Down
47 changes: 25 additions & 22 deletions src/trio/_core/_tests/test_guest_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,31 +418,34 @@ async def abandoned_main(in_host: InHost) -> None:
with pytest.raises(ZeroDivisionError):
trivial_guest_run(abandoned_main)

with pytest.warns(RuntimeWarning, match="Trio guest run got abandoned"):
with pytest.warns( # noqa: PT031
RuntimeWarning,
match="Trio guest run got abandoned",
):
A5rocks marked this conversation as resolved.
Show resolved Hide resolved
do_abandoned_guest_run()
gc_collect_harder()

# If you have problems some day figuring out what's holding onto a
# reference to the unrolled_run generator and making this test fail,
# then this might be useful to help track it down. (It assumes you
# also hack start_guest_run so that it does 'global W; W =
# weakref(unrolled_run_gen)'.)
#
# import gc
# print(trio._core._run.W)
# targets = [trio._core._run.W()]
# for i in range(15):
# new_targets = []
# for target in targets:
# new_targets += gc.get_referrers(target)
# new_targets.remove(targets)
# print("#####################")
# print(f"depth {i}: {len(new_targets)}")
# print(new_targets)
# targets = new_targets

with pytest.raises(RuntimeError):
trio.current_time()
# If you have problems some day figuring out what's holding onto a
# reference to the unrolled_run generator and making this test fail,
# then this might be useful to help track it down. (It assumes you
# also hack start_guest_run so that it does 'global W; W =
# weakref(unrolled_run_gen)'.)
#
# import gc
# print(trio._core._run.W)
# targets = [trio._core._run.W()]
# for i in range(15):
# new_targets = []
# for target in targets:
# new_targets += gc.get_referrers(target)
# new_targets.remove(targets)
# print("#####################")
# print(f"depth {i}: {len(new_targets)}")
# print(new_targets)
# targets = new_targets

with pytest.raises(RuntimeError):
trio.current_time()


def aiotrio_run(
Expand Down
5 changes: 4 additions & 1 deletion src/trio/_tests/test_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ def test_warning_class() -> None:
warn_deprecated("foo", "bar", issue=None, instead=None)

# essentially the same as the above check
with pytest.warns(DeprecationWarning):
with pytest.warns(
DeprecationWarning,
match="^foo is deprecated since Trio bar with no replacement$",
):
warn_deprecated("foo", "bar", issue=None, instead=None)

with pytest.warns(TrioDeprecationWarning):
Expand Down
8 changes: 4 additions & 4 deletions src/trio/_tests/test_dtls.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ async def start_and_forget_endpoint() -> int:
during_tasks = trio.lowlevel.current_statistics().tasks_living
return during_tasks

with pytest.warns(ResourceWarning):
with pytest.warns(ResourceWarning): # noqa: PT031
during_tasks = await start_and_forget_endpoint()
await trio.testing.wait_all_tasks_blocked()
gc_collect_harder()
Expand All @@ -765,7 +765,7 @@ async def start_and_forget_endpoint() -> int:
async def test_gc_before_system_task_starts() -> None:
e = endpoint()

with pytest.warns(ResourceWarning):
with pytest.warns(ResourceWarning): # noqa: PT031
del e
gc_collect_harder()

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

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

e = trio.run(main)
with pytest.warns(ResourceWarning):
with pytest.warns(ResourceWarning): # noqa: PT031
del e
gc_collect_harder()

Expand Down
4 changes: 2 additions & 2 deletions src/trio/_tests/test_subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def broken_terminate(self: Process) -> NoReturn:

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

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

with pytest.warns(RuntimeWarning, match=".*ignored SIGTERM.*"):
with pytest.warns(RuntimeWarning, match=".*ignored SIGTERM.*"): # noqa: PT031
async with _core.open_nursery() as nursery:
nursery.start_soon(run_process, SLEEP(9999))
await wait_all_tasks_blocked()
Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pyyaml==6.0.2
# via pre-commit
requests==2.32.3
# via sphinx
ruff==0.9.1
ruff==0.9.2
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand Down Expand Up @@ -181,7 +181,7 @@ typing-extensions==4.12.2
# pyright
urllib3==2.3.0
# via requests
uv==0.5.18
uv==0.5.21
# via -r test-requirements.in
virtualenv==20.28.0
# via pre-commit
Expand Down
Loading