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
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
4 changes: 2 additions & 2 deletions docs-requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RTD is currently installing 1.5.3, which has a bug in :lineno-match: (??)
# sphinx 5.3 doesn't work with our _NoValue workaround
sphinx >= 6.0
# sphinx 5.3 doesn't work with our _NoValue workaround, 9.0 breaks sphinxcontrib-trio
sphinx >= 6.0,<9.0
jinja2
# >= is necessary to prevent `uv` from selecting a `Sphinx` version this does not support
sphinx_rtd_theme >= 3
Expand Down
6 changes: 3 additions & 3 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ snowballstemmer==3.0.1
# via sphinx
sortedcontainers==2.4.0
# via -r docs-requirements.in
soupsieve==2.8.1
soupsieve==2.8.2
# via beautifulsoup4
sphinx==8.2.3
# via
Expand All @@ -80,7 +80,7 @@ sphinx==8.2.3
# sphinxcontrib-trio
sphinx-codeautolink==0.17.5
# via -r docs-requirements.in
sphinx-rtd-theme==3.0.2
sphinx-rtd-theme==3.1.0
# via -r docs-requirements.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
Expand All @@ -107,5 +107,5 @@ typing-extensions==4.15.0
# beautifulsoup4
# exceptiongroup
# pyopenssl
urllib3==2.6.2
urllib3==2.6.3
# via requests
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
28 changes: 14 additions & 14 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 @@ -44,7 +44,7 @@ cryptography==46.0.3
# pyopenssl
# trustme
# types-pyopenssl
dill==0.4.0
dill==0.4.1
# via pylint
distlib==0.4.0
# via virtualenv
Expand All @@ -56,9 +56,9 @@ exceptiongroup==1.3.1 ; python_full_version < '3.11'
# via
# -r test-requirements.in
# pytest
filelock==3.20.2
filelock==3.20.3
# via virtualenv
identify==2.6.15
identify==2.6.16
# via pre-commit
idna==3.11
# via
Expand All @@ -75,7 +75,7 @@ jedi==0.19.2 ; implementation_name == 'cpython'
# via -r test-requirements.in
jinja2==3.1.6
# via sphinx
librt==0.7.7 ; implementation_name == 'cpython' and platform_python_implementation != 'PyPy'
librt==0.7.8 ; implementation_name == 'cpython' and platform_python_implementation != 'PyPy'
# via mypy
markupsafe==3.0.3
# via jinja2
Expand All @@ -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 All @@ -124,19 +124,19 @@ pylint==4.0.4
# via -r test-requirements.in
pyopenssl==25.3.0
# via -r test-requirements.in
pyright==1.1.407
pyright==1.1.408
# via -r test-requirements.in
pytest==9.0.2
# via -r test-requirements.in
pytokens==0.3.0 ; implementation_name == 'cpython'
pytokens==0.4.0 ; implementation_name == 'cpython'
# via black
pyyaml==6.0.3
# via pre-commit
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 All @@ -162,14 +162,14 @@ sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
tomli==2.3.0 ; python_full_version < '3.11'
tomli==2.4.0 ; python_full_version < '3.11'
# via
# black
# mypy
# pylint
# pytest
# sphinx
tomlkit==0.13.3
tomlkit==0.14.0
# via pylint
trustme==1.2.1
# via -r test-requirements.in
Expand All @@ -196,9 +196,9 @@ typing-extensions==4.15.0
# pyopenssl
# pyright
# virtualenv
urllib3==2.6.2
urllib3==2.6.3
# via requests
uv==0.9.24
uv==0.9.26
# via -r test-requirements.in
virtualenv==20.35.4
virtualenv==20.36.1
# via pre-commit