Description
Things to check first
-
I have searched the existing issues and didn't find my bug already reported there
-
I have checked that my bug is still present in the latest release
AnyIO version
4.4.0
Python version
3.13.0b1
What happened?
______________________________________________________________________________________ TestPath.test_properties[asyncio] _______________________________________________________________________________________
tests/test_fileio.py:103: in test_properties
assert not missing
E AssertionError: assert not {'from_uri', 'full_match', 'parser'}
___________________________________________________________________________________ TestPath.test_properties[asyncio+uvloop] ___________________________________________________________________________________
tests/test_fileio.py:103: in test_properties
assert not missing
E AssertionError: assert not {'from_uri', 'full_match', 'parser'}
________________________________________________________________________________________ TestPath.test_properties[trio] ________________________________________________________________________________________
tests/test_fileio.py:103: in test_properties
assert not missing
E AssertionError: assert not {'from_uri', 'full_match', 'parser'}
__________________________________________________________________________________________ TestPath.test_is_reserved ___________________________________________________________________________________________
tests/test_fileio.py:274: in test_is_reserved
assert Path("nul").is_reserved() == expected_result
src/anyio/_core/_fileio.py:445: in is_reserved
return self._path.is_reserved()
/usr/lib64/python3.13/pathlib/_local.py:423: in is_reserved
warnings.warn(msg, DeprecationWarning, stacklevel=2)
E DeprecationWarning: pathlib.PurePath.is_reserved() is deprecated and scheduled for removal in Python 3.15. Use os.path.isreserved() to detect reserved paths on Windows.
I expected these four tests to pass, as they do on Python 3.12.
How can we reproduce the bug?
$ gh repo clone agroholm/anyio
$ cd anyio
$ python3.13 --version
Python 3.13.0b1
$ python3.13 -m venv _e
$ . _e/bin/activate
Before proceeding further, we need to build uvloop
ourselves, since the released sdist doesn’t build on Python 3.13 and there are no binary wheels on PyPI for Python 3.13 yet. Furthermore, we need to patch it for Cython 3 as proposed in MagicStack/uvloop#587. This reflects how uvloop
is packaged in Fedora.
(_e) $ cd ..
(_e) $ gh repo clone MagicStack/uvloop
(_e) $ cd uvloop
(_e) $ git submodule update --init --recursive
(_e) $ git remote add alan-brooks https://github.com/alan-brooks/uvloop.git
(_e) $ git fetch --all
(_e) $ git branch cython3
(_e) $ git checkout cython3
(_e) $ git merge alan-brooks/cython3_update
(_e) $ sed -r -i 's/(Cython\(>=.*,<)(.*)(\))/\14\3/' pyproject.toml
(_e) $ git add pyproject.toml
(_e) $ git commit -m 'Allow Cython 3'
(_e) $ pip install .
Furthermore, to avoid errors about undefined symbol: _PyErr_WriteUnraisableMsg
, we need cffi
to contain python-cffi/cffi@49127c6. The easiest way is to manually install 1.17.0rc1.
(_e) $ pip install cffi==1.17.0rc1
Now we can continue:
(_e) $ cd ../anyio
(_e) $ pip install -e .[test]
(_e) $ python -m pytest
=========================================================================================== short test summary info ============================================================================================
SKIPPED [1] tests/test_debugging.py:102: Generator based coroutines have been removed in Python 3.11
SKIPPED [1] tests/test_fileio.py:135: Drive only makes sense on Windows
SKIPPED [1] tests/test_fileio.py:177: Only makes sense on Windows
SKIPPED [3] tests/test_fileio.py:366: os.lchmod() is not available
SKIPPED [1] tests/test_taskgroups.py:964: Generator based coroutines have been removed in Python 3.11
SKIPPED [1] tests/test_taskgroups.py:985: Generator based coroutines have been removed in Python 3.11
XFAIL tests/test_from_thread.py::TestBlockingPortal::test_from_async[trio-trio] - reason: known bug (#525)
XFAIL tests/test_subprocesses.py::test_process_aexit_cancellation_closes_standard_streams[asyncio] - #671 needs to be resolved first
XFAIL tests/test_subprocesses.py::test_process_aexit_cancellation_closes_standard_streams[asyncio+uvloop] - #671 needs to be resolved first
XFAIL tests/test_taskgroups.py::test_fail_after_scope_cancelled_before_timeout[asyncio] - There is currently no way to tell if cancellation happened due to timeout explicitly if the deadline has been exceeded
XFAIL tests/test_taskgroups.py::test_fail_after_scope_cancelled_before_timeout[asyncio+uvloop] - There is currently no way to tell if cancellation happened due to timeout explicitly if the deadline has been exceeded
XFAIL tests/test_taskgroups.py::test_fail_after_scope_cancelled_before_timeout[trio] - There is currently no way to tell if cancellation happened due to timeout explicitly if the deadline has been exceeded
============================================================================ 55 failed, 1379 passed, 8 skipped, 6 xfailed in 36.48s ============================================================================
I’m not as worried about the failures in tests/test_sockets.py
due to socket.gaierror: [Errno -2] Name or service not known
– we run tests offline in Fedora, so we don’t see these, and these reproduce in Python 3.12 – but failures in tests/test_fileio.py
appear to be real regressions in Python 3.13.