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 @@ -24,7 +24,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.6
rev: v0.14.7
hooks:
- id: ruff-check
types: [file]
Expand All @@ -38,15 +38,15 @@ repos:
# tomli needed on 3.10. tomllib is available in stdlib on 3.11+
- tomli
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.39.2
rev: v1.40.0
hooks:
- id: typos
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.2
hooks:
- id: sphinx-lint
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.16.3
rev: v1.18.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.11
rev: 0.9.14
hooks:
# Compile requirements
- id: pip-compile
Expand Down
8 changes: 4 additions & 4 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ attrs==25.4.0
# outcome
babel==2.17.0
# via sphinx
beautifulsoup4==4.14.2
beautifulsoup4==4.14.3
# via sphinx-codeautolink
certifi==2025.10.5
certifi==2025.11.12
# via requests
cffi==2.0.0 ; os_name == 'nt' or platform_python_implementation != 'PyPy'
# via
# -r docs-requirements.in
# cryptography
charset-normalizer==3.4.4
# via requests
click==8.3.0
click==8.3.1
# via towncrier
colorama==0.4.6 ; sys_platform == 'win32'
# via
Expand All @@ -30,7 +30,7 @@ docutils==0.21.2
# via
# sphinx
# sphinx-rtd-theme
exceptiongroup==1.3.0
exceptiongroup==1.3.1
# via -r docs-requirements.in
idna==3.11
# via
Expand Down
6 changes: 4 additions & 2 deletions src/trio/_core/_tests/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ async def async_main() -> None:
saved.append(agen())
await saved[-1].asend(None)

ATTEMPT_AMOUNT = 50

# Actually running into the edge case requires that the run_sync_soon task
# execute in between the system nursery's closure and the strong-ification
# of runner.asyncgens. There's about a 25% chance that it doesn't
# (if the run_sync_soon task runs before init on one tick and after init
# on the next tick); if we try enough times, we can make the chance of
# failure as small as we want.
for _attempt in range(50):
for _ in range(ATTEMPT_AMOUNT):
needs_retry = False
record.clear()
saved.clear()
Expand All @@ -240,7 +242,7 @@ async def async_main() -> None:
else: # pragma: no cover
pytest.fail(
"Didn't manage to hit the trailing_finalizer_asyncgens case "
f"despite trying {_attempt} times",
f"despite trying {ATTEMPT_AMOUNT} times",
)


Expand Down
8 changes: 4 additions & 4 deletions src/trio/_core/_tests/test_ki.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def protected_manager() -> Iterator[None]:
@pytest.mark.skipif(async_generator is None, reason="async_generator not installed")
async def test_async_generator_agen_protection() -> None:
@_core.enable_ki_protection
@async_generator # type: ignore[misc] # untyped generator
@async_generator # type: ignore[untyped-decorator]
async def agen_protected1() -> None: # type: ignore[misc] # untyped generator
assert _core.currently_ki_protected()
try:
Expand All @@ -173,7 +173,7 @@ async def agen_protected1() -> None: # type: ignore[misc] # untyped generator
assert _core.currently_ki_protected()

@_core.disable_ki_protection
@async_generator # type: ignore[misc] # untyped generator
@async_generator # type: ignore[untyped-decorator]
async def agen_unprotected1() -> None: # type: ignore[misc] # untyped generator
assert not _core.currently_ki_protected()
try:
Expand All @@ -182,7 +182,7 @@ async def agen_unprotected1() -> None: # type: ignore[misc] # untyped generator
assert not _core.currently_ki_protected()

# Swap the order of the decorators:
@async_generator # type: ignore[misc] # untyped generator
@async_generator # type: ignore[untyped-decorator]
@_core.enable_ki_protection
async def agen_protected2() -> None: # type: ignore[misc] # untyped generator
assert _core.currently_ki_protected()
Expand All @@ -191,7 +191,7 @@ async def agen_protected2() -> None: # type: ignore[misc] # untyped generator
finally:
assert _core.currently_ki_protected()

@async_generator # type: ignore[misc] # untyped generator
@async_generator # type: ignore[untyped-decorator]
@_core.disable_ki_protection
async def agen_unprotected2() -> None: # type: ignore[misc] # untyped generator
assert not _core.currently_ki_protected()
Expand Down
8 changes: 8 additions & 0 deletions src/trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def no_underscores(symbols: Iterable[str]) -> set[str]:
completions = script.complete()
static_names = no_underscores(c.name for c in completions)
elif tool == "mypy":
if sys.implementation.name != "cpython":
# https://github.com/python/mypy/issues/20329
pytest.skip("mypy does not support pypy")

if not RUN_SLOW: # pragma: no cover
pytest.skip("use --run-slow to check against mypy")

Expand Down Expand Up @@ -272,6 +276,10 @@ def no_hidden(symbols: Iterable[str]) -> set[str]:
if tool == "jedi" and sys.implementation.name != "cpython":
pytest.skip("jedi does not support pypy")

if tool == "mypy" and sys.implementation.name != "cpython":
# https://github.com/python/mypy/issues/20329
pytest.skip("mypy does not support pypy")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, why didn't that show up as a status for the PR! (or maybe I missed it :/)


if tool == "mypy":
cache = Path.cwd() / ".mypy_cache"

Expand Down
6 changes: 3 additions & 3 deletions src/trio/_tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,16 @@ async def test_globmethods(path: trio.Path) -> None:
await (path / "bar.dat").write_bytes(b"")

# Path.glob
for _pattern, _results in {
for pattern, results in {
"*.txt": {"bar.txt"},
"**/*.txt": {"_bar.txt", "bar.txt"},
}.items():
entries = set()
for entry in await path.glob(_pattern):
for entry in await path.glob(pattern):
assert isinstance(entry, trio.Path)
entries.add(entry.name)

assert entries == _results
assert entries == results

# Path.rglob
entries = set()
Expand Down
6 changes: 3 additions & 3 deletions src/trio/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
# have:
globals().update(
{
_name: getattr(_stdlib_socket, _name)
for _name in _stdlib_socket.__all__
if _name.isupper() and _name not in _bad_symbols
name: getattr(_stdlib_socket, name)
for name in _stdlib_socket.__all__
if name.isupper() and name not in _bad_symbols
},
)

Expand Down
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cryptography>=41.0.0 # cryptography<41 segfaults on pypy3.10

# Tools
black; implementation_name == "cpython"
mypy
mypy; implementation_name == "cpython"
ruff >= 0.8.0
astor # code generation
uv >= 0.2.24
Expand Down
36 changes: 20 additions & 16 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ babel==2.17.0
# via sphinx
black==25.11.0 ; implementation_name == 'cpython'
# via -r test-requirements.in
certifi==2025.10.5
certifi==2025.11.12
# via requests
cffi==2.0.0 ; os_name == 'nt' or platform_python_implementation != 'PyPy'
# via
# -r test-requirements.in
# cryptography
cfgv==3.4.0
cfgv==3.5.0
# via pre-commit
charset-normalizer==3.4.4
# via requests
click==8.3.0 ; implementation_name == 'cpython'
click==8.3.1 ; implementation_name == 'cpython'
# via black
codespell==2.4.1
# via -r test-requirements.in
Expand All @@ -36,7 +36,7 @@ colorama==0.4.6 ; sys_platform == 'win32'
# pylint
# pytest
# sphinx
coverage==7.11.3
coverage==7.12.0
# via -r test-requirements.in
cryptography==46.0.3
# via
Expand All @@ -48,9 +48,11 @@ dill==0.4.0
# via pylint
distlib==0.4.0
# via virtualenv
docutils==0.21.2
docutils==0.21.2 ; python_full_version < '3.11'
# via sphinx
exceptiongroup==1.3.0 ; python_full_version < '3.11'
docutils==0.22.3 ; python_full_version >= '3.11'
# via sphinx
exceptiongroup==1.3.1 ; python_full_version < '3.11'
# via
# -r test-requirements.in
# pytest
Expand All @@ -73,11 +75,13 @@ jedi==0.19.2 ; implementation_name == 'cpython'
# via -r test-requirements.in
jinja2==3.1.6
# via sphinx
librt==0.6.3 ; implementation_name == 'cpython'
# via mypy
markupsafe==3.0.3
# via jinja2
mccabe==0.7.0
# via pylint
mypy==1.18.2
mypy==1.19.0 ; implementation_name == 'cpython'
# via -r test-requirements.in
mypy-extensions==1.1.0
# via
Expand All @@ -97,7 +101,7 @@ packaging==25.0
# sphinx
parso==0.8.5 ; implementation_name == 'cpython'
# via jedi
pathspec==0.12.1
pathspec==0.12.1 ; implementation_name == 'cpython'
# via
# black
# mypy
Expand All @@ -108,31 +112,31 @@ platformdirs==4.5.0
# virtualenv
pluggy==1.6.0
# via pytest
pre-commit==4.4.0
pre-commit==4.5.0
# via -r test-requirements.in
pycparser==2.23 ; (implementation_name != 'PyPy' and os_name == 'nt') or (implementation_name != 'PyPy' and platform_python_implementation != 'PyPy')
# via cffi
pygments==2.19.2
# via
# pytest
# sphinx
pylint==4.0.2
pylint==4.0.4
# via -r test-requirements.in
pyopenssl==25.3.0
# via -r test-requirements.in
pyright==1.1.407
# via -r test-requirements.in
pytest==9.0.0
pytest==9.0.1
# via -r test-requirements.in
pytokens==0.3.0 ; implementation_name == 'cpython'
# via black
pyyaml==6.0.3
# via pre-commit
requests==2.32.5
# via sphinx
roman-numerals-py==3.1.0 ; python_full_version >= '3.11'
roman-numerals==3.1.0 ; python_full_version >= '3.11'
# via sphinx
ruff==0.14.6
ruff==0.14.7
# via -r test-requirements.in
sniffio==1.3.1
# via -r test-requirements.in
Expand All @@ -142,7 +146,7 @@ sortedcontainers==2.4.0
# via -r test-requirements.in
sphinx==8.1.3 ; python_full_version < '3.11'
# via -r test-requirements.in
sphinx==8.2.3 ; python_full_version >= '3.11'
sphinx==9.0.1 ; python_full_version >= '3.11'
# via -r test-requirements.in
sphinxcontrib-applehelp==2.0.0
# via sphinx
Expand Down Expand Up @@ -171,7 +175,7 @@ types-cffi==1.17.0.20250915
# via
# -r test-requirements.in
# types-pyopenssl
types-docutils==0.22.2.20251006
types-docutils==0.22.3.20251115
# via -r test-requirements.in
types-pyopenssl==24.1.0.20240722
# via -r test-requirements.in
Expand All @@ -192,7 +196,7 @@ typing-extensions==4.15.0
# virtualenv
urllib3==2.5.0
# via requests
uv==0.9.11
uv==0.9.14
# via -r test-requirements.in
virtualenv==20.35.4
# via pre-commit