Skip to content

Commit

Permalink
tests: test_fileio.py: don't follow symlinks in /dev (#626)
Browse files Browse the repository at this point in the history
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().
  • Loading branch information
jirislaby authored Nov 3, 2023
1 parent 9fcfc1f commit 9ba2544
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test_fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9ba2544

Please sign in to comment.