From: Jiri Slaby Date: Thu, 2 Nov 2023 11:37:44 +0100 Subject: tests: test_fileio.py: don't follow symlinks in /dev Patch-mainline: submitted https://github.com/agronholm/anyio/pull/626 References: fix for kernel 6.6 There might be a broken one like /dev/log and this causes the tests to fail. This is highly is unpredictable, because os.scandir() sometimes returns a block device, sometimes the broken link is hit. So pass follow_symlinks=False to entry.stat(). --- tests/test_fileio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_fileio.py b/tests/test_fileio.py index 9e6b2a8325..c4801187db 100644 --- a/tests/test_fileio.py +++ b/tests/test_fileio.py @@ -218,7 +218,7 @@ class TestPath: assert not await Path("/btelkbee").is_block_device() with os.scandir("/dev") as iterator: for entry in iterator: - if stat.S_ISBLK(entry.stat().st_mode): + if stat.S_ISBLK(entry.stat(follow_symlinks=False).st_mode): assert await Path(entry.path).is_block_device() break else: -- 2.42.0