From 8008eab59a0c1c05c76605ea301c81cf90c35638 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 2 Nov 2023 11:37:44 +0100 Subject: [PATCH] tests: test_fileio.py: don't follow symlinks in /dev 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 9e6b2a83..c4801187 100644 --- a/tests/test_fileio.py +++ b/tests/test_fileio.py @@ -218,7 +218,7 @@ async def test_is_block_device(self) -> None: 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: