[Debian-med-packaging] Bug#935743: cwltool: psutil.tests not importable on s390x

Steve Langasek steve.langasek at canonical.com
Sun Aug 25 20:11:06 BST 2019


Package: cwltool
Version: 1.0.20190815141648+dfsg-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu eoan ubuntu-patch

Hi Michael,

After fixing the issue in Ubuntu with the missing python3-mock test
dependency, we still have one architecture-specific test failure on s390x:

==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_udocker.py ____________________
/usr/lib/python3/dist-packages/cwltool/tests/test_udocker.py:8: in <module>
    from psutil.tests import TRAVIS
/usr/lib/python3/dist-packages/psutil/tests/__init__.py:175: in <module>
    HAS_BATTERY = HAS_SENSORS_BATTERY and bool(psutil.sensors_battery())
/usr/lib/python3/dist-packages/psutil/__init__.py:2360: in sensors_battery
    return _psplatform.sensors_battery()
/usr/lib/python3/dist-packages/psutil/_pslinux.py:1341: in sensors_battery
    bats = [x for x in os.listdir(POWER_SUPPLY_PATH) if x.startswith('BAT')]
E   FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/power_supply'

Since s390x has no physical hardware (the entire architecture is
virtualized), the kernel may not have drivers enabled that cause the
/sys/class/power_supply directory to exist.  In general, other software
/ doesn't mind this, but the psutil.tests module does and this causes the
/ cwltool testsuite to fail.

The python-psutil package's own autopkgtests pass on s390x.

So I think a try/except around this import statement is the best option. 
Please see attached for a possible patch.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru cwltool-1.0.20190815141648+dfsg/debian/patches/s390x-no-sys-class-power.patch cwltool-1.0.20190815141648+dfsg/debian/patches/s390x-no-sys-class-power.patch
--- cwltool-1.0.20190815141648+dfsg/debian/patches/s390x-no-sys-class-power.patch	1969-12-31 16:00:00.000000000 -0800
+++ cwltool-1.0.20190815141648+dfsg/debian/patches/s390x-no-sys-class-power.patch	2019-08-25 12:02:48.000000000 -0700
@@ -0,0 +1,25 @@
+Description: handle psutils.tests not being importable on s390x
+ The psutils.tests module fails to import if /sys/class/power_supply does
+ not exist, which it won't on s390x (at least with certain Linux kernel
+ configurations).  If we're on a s390x kernel and this import fails, it's
+ a reasonably safe assumption that we're not running under travis.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Modified: 2019-08-25
+
+Index: cwltool-1.0.20190815141648+dfsg/tests/test_udocker.py
+===================================================================
+--- cwltool-1.0.20190815141648+dfsg.orig/tests/test_udocker.py
++++ cwltool-1.0.20190815141648+dfsg/tests/test_udocker.py
+@@ -5,7 +5,11 @@
+ from .util import get_data, get_main_output
+ import tempfile
+ import shutil
+-from psutil.tests import TRAVIS
++try:
++    # fails on s390x
++    from psutil.tests import TRAVIS
++except:
++    TRAVIS = False
+ 
+ LINUX = sys.platform in ('linux', 'linux2')
+ 
diff -Nru cwltool-1.0.20190815141648+dfsg/debian/patches/series cwltool-1.0.20190815141648+dfsg/debian/patches/series
--- cwltool-1.0.20190815141648+dfsg/debian/patches/series	2019-08-13 06:29:27.000000000 -0700
+++ cwltool-1.0.20190815141648+dfsg/debian/patches/series	2019-08-25 11:59:47.000000000 -0700
@@ -6,3 +6,4 @@
 python3
 pathlib2
 pytest
+s390x-no-sys-class-power.patch


More information about the Debian-med-packaging mailing list