[packages/python3-sh] - test fixes

qboosh qboosh at pld-linux.org
Sun Jan 11 11:12:10 CET 2026


commit bfd86edb7a31acf85466b9554d5b9c1a5007964f
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Jan 11 11:12:09 2026 +0100

    - test fixes

 python3-sh.spec |  4 ++++
 sh-tests.patch  | 11 +++++++++++
 sh-udev.patch   | 30 ++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+)
---
diff --git a/python3-sh.spec b/python3-sh.spec
index cc819b1..d9a3361 100644
--- a/python3-sh.spec
+++ b/python3-sh.spec
@@ -12,6 +12,8 @@ License:	MIT
 Group:		Libraries/Python
 Source0:	https://files.pythonhosted.org/packages/source/s/sh/%{module}-%{version}.tar.gz
 # Source0-md5:	961d38de16f88556bd70381eddd7f415
+Patch0:		sh-udev.patch
+Patch1:		sh-tests.patch
 URL:		https://pypi.org/project/sh/
 BuildRequires:	python3-build
 BuildRequires:	python3-installer
@@ -38,6 +40,8 @@ funkcją.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch -P0 -p1
+%patch -P1 -p1
 
 %build
 %py3_build_pyproject
diff --git a/sh-tests.patch b/sh-tests.patch
new file mode 100644
index 0000000..bd7c1ba
--- /dev/null
+++ b/sh-tests.patch
@@ -0,0 +1,11 @@
+--- sh-2.2.2/tests/sh_test.py.orig	2026-01-11 10:55:13.222697999 +0100
++++ sh-2.2.2/tests/sh_test.py	2026-01-11 11:01:15.431328461 +0100
+@@ -545,6 +545,8 @@ while True:
+ 
+         # this is the environment we'll pass into our commands
+         env = {"HERP": "DERP"}
++        if "PYTHONPATH" in os.environ:
++            env["PYTHONPATH"] = os.environ["PYTHONPATH"]
+ 
+         # first we test that the environment exists in our child process as
+         # we've set it
diff --git a/sh-udev.patch b/sh-udev.patch
new file mode 100644
index 0000000..245988d
--- /dev/null
+++ b/sh-udev.patch
@@ -0,0 +1,30 @@
+Some udev-based systems don't have /dev/fd symlink
+--- sh-2.2.2/tests/sh_test.py.orig	1970-01-01 01:00:00.000000000 +0100
++++ sh-2.2.2/tests/sh_test.py	2026-01-11 10:40:53.878040216 +0100
+@@ -622,7 +622,7 @@ print("hi")
+         py = create_tmp_test(
+             """
+ import os
+-print(len(os.listdir("/dev/fd")))
++print(len(os.listdir("/proc/self/fd")))
+ """
+         )
+         out = python(py.name, _close_fds=False).strip()
+@@ -650,7 +650,7 @@ print(len(os.listdir("/dev/fd")))
+         py = create_tmp_test(
+             """
+ import os
+-print(os.listdir("/dev/fd"))
++print(os.listdir("/proc/self/fd"))
+ """
+         )
+         out = python(py.name).strip()
+@@ -677,7 +677,7 @@ print(os.listdir("/dev/fd"))
+         py = create_tmp_test(
+             """
+ import os
+-print(os.listdir("/dev/fd"))
++print(os.listdir("/proc/self/fd"))
+ """
+         )
+         out = python(py.name, _pass_fds=[last_fd]).strip()
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python3-sh.git/commitdiff/bfd86edb7a31acf85466b9554d5b9c1a5007964f



More information about the pld-cvs-commit mailing list