Skip to content
Closed
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ repos:
- id: sort-simple-yaml
files: .pre-commit-config.yaml
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.11
rev: v0.14.13
hooks:
- id: ruff-check
types: [file]
Expand All @@ -46,7 +46,7 @@ repos:
hooks:
- id: sphinx-lint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.20.0
rev: v1.22.0
hooks:
- id: zizmor
- repo: local
Expand All @@ -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.9.24
rev: 0.9.26
hooks:
# Compile requirements
- id: pip-compile
Expand Down
1 change: 1 addition & 0 deletions src/trio/_tests/check_type_completeness.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
If this check is giving you false alarms, you can ignore them by adding logic to `has_docstring_at_runtime`, in the main loop in `check_type`, or by updating the json file.
"""

from __future__ import annotations

# this file is not run as part of the tests, instead it's run standalone from check.sh
Expand Down
20 changes: 4 additions & 16 deletions src/trio/_tests/test_deprecate.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,45 +200,33 @@ def docstring_test4() -> None: # pragma: no cover


def test_deprecated_docstring_munging() -> None:
assert (
docstring_test1.__doc__
== """Hello!
assert docstring_test1.__doc__ == """Hello!

.. deprecated:: 2.1
Use hi instead.
For details, see `issue #1 <https://github.com/python-trio/trio/issues/1>`__.

"""
)

assert (
docstring_test2.__doc__
== """Hello!
assert docstring_test2.__doc__ == """Hello!

.. deprecated:: 2.1
Use hi instead.

"""
)

assert (
docstring_test3.__doc__
== """Hello!
assert docstring_test3.__doc__ == """Hello!

.. deprecated:: 2.1
For details, see `issue #1 <https://github.com/python-trio/trio/issues/1>`__.

"""
)

assert (
docstring_test4.__doc__
== """Hello!
assert docstring_test4.__doc__ == """Hello!

.. deprecated:: 2.1

"""
)


def test_module_with_deprecations(recwarn_always: pytest.WarningsRecorder) -> None:
Expand Down
10 changes: 5 additions & 5 deletions src/trio/_tests/test_fakenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ async def test_recv_methods() -> None:
buf = bytearray(10)

with pytest.raises(NotImplementedError, match=r"^partial recvfrom_into$"):
(nbytes, addr) = await s2.recvfrom_into(buf, nbytes=2)
nbytes, addr = await s2.recvfrom_into(buf, nbytes=2)

(nbytes, addr) = await s2.recvfrom_into(buf)
nbytes, addr = await s2.recvfrom_into(buf)
assert nbytes == 3
assert buf == b"ghi" + b"\x00" * 7
assert addr == s1.getsockname()
Expand Down Expand Up @@ -154,7 +154,7 @@ async def test_nonwindows_functionality() -> None:
assert exc.value.errno == errno.ENOTCONN

assert await s1.sendmsg([b"jkl"], (), 0, s2.getsockname()) == 3
(data, ancdata, msg_flags, addr) = await s2.recvmsg(10)
data, ancdata, msg_flags, addr = await s2.recvmsg(10)
assert data == b"jkl"
assert ancdata == []
assert msg_flags == 0
Expand All @@ -167,7 +167,7 @@ async def test_nonwindows_functionality() -> None:
buf1 = bytearray(2)
buf2 = bytearray(3)
ret = await s2.recvmsg_into([buf1, buf2])
(nbytes, ancdata, msg_flags, addr) = ret
nbytes, ancdata, msg_flags, addr = ret
assert nbytes == 4
assert buf1 == b"xy"
assert buf2 == b"zw" + b"\x00"
Expand All @@ -179,7 +179,7 @@ async def test_nonwindows_functionality() -> None:
assert await s1.sendto(b"xyzwv", s2.getsockname()) == 5
buf1 = bytearray(2)
ret = await s2.recvmsg_into([buf1])
(nbytes, ancdata, msg_flags, addr) = ret
nbytes, ancdata, msg_flags, addr = ret
assert nbytes == 2
assert buf1 == b"xy"
assert ancdata == []
Expand Down
10 changes: 5 additions & 5 deletions src/trio/_tests/test_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ async def test_send_recv_variants() -> None:
# recvfrom + sendto, with and without names
for target in targets:
assert await a.sendto(b"xxx", target) == 3
(data, addr) = await b.recvfrom(10)
data, addr = await b.recvfrom(10)
assert data == b"xxx"
assert addr == a.getsockname()

Expand All @@ -991,21 +991,21 @@ async def test_send_recv_variants() -> None:
await a.sendto(b"xxx", tsocket.MSG_MORE, b.getsockname())
await a.sendto(b"yyy", tsocket.MSG_MORE, b.getsockname())
await a.sendto(b"zzz", b.getsockname())
(data, addr) = await b.recvfrom(10)
data, addr = await b.recvfrom(10)
assert data == b"xxxyyyzzz"
assert addr == a.getsockname()

# recvfrom_into
assert await a.sendto(b"xxx", b.getsockname()) == 3
buf = bytearray(10)
(nbytes, addr) = await b.recvfrom_into(buf)
nbytes, addr = await b.recvfrom_into(buf)
assert nbytes == 3
assert buf == b"xxx" + b"\x00" * 7
assert addr == a.getsockname()

if hasattr(b, "recvmsg"):
assert await a.sendto(b"xxx", b.getsockname()) == 3
(data, ancdata, msg_flags, addr) = await b.recvmsg(10)
data, ancdata, msg_flags, addr = await b.recvmsg(10)
assert data == b"xxx"
assert ancdata == []
assert msg_flags == 0
Expand All @@ -1016,7 +1016,7 @@ async def test_send_recv_variants() -> None:
buf1 = bytearray(2)
buf2 = bytearray(3)
ret = await b.recvmsg_into([buf1, buf2])
(nbytes, ancdata, msg_flags, addr) = ret
nbytes, ancdata, msg_flags, addr = ret
assert nbytes == 4
assert buf1 == b"xy"
assert buf2 == b"zw" + b"\x00"
Expand Down
2 changes: 1 addition & 1 deletion src/trio/_tests/test_unix_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

async def make_pipe() -> tuple[FdStream, FdStream]:
"""Makes a new pair of pipes."""
(r, w) = os.pipe()
r, w = os.pipe()
return FdStream(w), FdStream(r)


Expand Down
2 changes: 1 addition & 1 deletion src/trio/_tests/test_windows_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

async def make_pipe() -> tuple[PipeSendStream, PipeReceiveStream]:
"""Makes a new pair of pipes."""
(r, w) = pipe()
r, w = pipe()
return PipeSendStream(w), PipeReceiveStream(r)


Expand Down
5 changes: 1 addition & 4 deletions src/trio/_tests/tools/test_sync_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ def test_update_requirements(
encoding="utf-8",
)
assert update_requirements(requirements_file, {"black": "3.1.5", "ruff": "1.2.7"})
assert (
requirements_file.read_text(encoding="utf-8")
== """# comment
assert requirements_file.read_text(encoding="utf-8") == """# comment
# also comment but spaces line start
waffles are delicious no equals
black==3.1.5 ; specific version thingy
mypy==1.15.0
ruff==1.2.7
# required by soupy cat"""
)


def test_update_requirements_no_changes(
Expand Down
1 change: 1 addition & 0 deletions src/trio/_tools/gen_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Code generation script for class methods
to be exported as public API
"""

from __future__ import annotations

import argparse
Expand Down
8 changes: 4 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ attrs==25.4.0
# outcome
babel==2.17.0
# via sphinx
black==25.12.0 ; implementation_name == 'cpython'
black==26.1.0 ; implementation_name == 'cpython'
# via -r test-requirements.in
certifi==2026.1.4
# via requests
Expand Down Expand Up @@ -101,7 +101,7 @@ packaging==25.0
# sphinx
parso==0.8.5 ; implementation_name == 'cpython'
# via jedi
pathspec==0.12.1 ; implementation_name == 'cpython'
pathspec==1.0.3 ; implementation_name == 'cpython'
# via
# black
# mypy
Expand Down Expand Up @@ -136,7 +136,7 @@ requests==2.32.5
# via sphinx
roman-numerals==4.1.0 ; python_full_version >= '3.11'
# via sphinx
ruff==0.14.11
ruff==0.14.13
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand Down Expand Up @@ -198,7 +198,7 @@ typing-extensions==4.15.0
# virtualenv
urllib3==2.6.2
# via requests
uv==0.9.24
uv==0.9.26
# via -r test-requirements.in
virtualenv==20.35.4
# via pre-commit
Loading