Accepting request 1122463 from home:jirislaby:branches:devel:languages:python

- add tests-test_fileio.py-don-t-follow-symlinks-in-dev.patch (kernel
  6.6 fix)

OBS-URL: https://build.opensuse.org/request/show/1122463
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-anyio?expand=0&rev=29
This commit is contained in:
Markéta Machová 2023-11-02 12:31:00 +00:00 committed by Git OBS Bridge
parent 651e32b550
commit 3bb72dd601
3 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 2 10:42:51 UTC 2023 - Jiri Slaby <jslaby@suse.cz>
- add tests-test_fileio.py-don-t-follow-symlinks-in-dev.patch (kernel
6.6 fix)
-------------------------------------------------------------------
Thu May 4 07:29:22 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>

View File

@ -28,6 +28,8 @@ Source: https://files.pythonhosted.org/packages/source/a/anyio/anyio-%{v
Patch0: support-trio-0.22.patch
# PATCH-FIX-UPSTREAM Based on gh#agronholm/anyio#553
Patch1: fix-failing-tls-tests.patch
# PATCH-FIX-UPSTREAM see gh#agronholm/anyio#626
Patch2: tests-test_fileio.py-don-t-follow-symlinks-in-dev.patch
BuildRequires: %{python_module contextlib2 if %python-base < 3.7}
BuildRequires: %{python_module dataclasses if %python-base < 3.7}
BuildRequires: %{python_module idna >= 2.8}

View File

@ -0,0 +1,33 @@
From: Jiri Slaby <jirislaby@gmail.com>
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