[elbe-devel] [PATCH 06/10] add build dependencies needed by unit tests

Manuel Traut manut at linutronix.de
Fri Sep 29 00:11:42 CEST 2017


the unit-tests are executed during debian packaging so the packages
required by elbe-runtime need also be available at build-time.

however some python modules are not packaged for python3 in debian, so
catch the ImportException to let the unittest work. This is also nicer
for users than getting a backtrace:

dpkg-buildpackage (pybuild) for python3 executes automaticly unittests,
but they crash because of the missing import:

   dh_auto_test -O--buildsystem=pybuild

I: pybuild base:184: cd /build/elbe-2.9.1+buster511/.pybuild/pythonX.Y_2.7/build; python2.7 -m unittest discover -v
----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
I: pybuild base:184: cd /build/elbe-2.9.1+buster511/.pybuild/pythonX.Y_3.5/build; python3.5 -m unittest discover -v
python*-spyne is not installed
failed to import soap_faults
failed to import esoap
failed to import beaker
failed to import spyne
elbepack.daemons.soap (unittest.loader._FailedTest) ... ERROR

======================================================================
ERROR: elbepack.daemons.soap (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: elbepack.daemons.soap
Traceback (most recent call last):
  File "/usr/lib/python3.5/unittest/loader.py", line 462, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/build/elbe-2.9.1+buster511/.pybuild/pythonX.Y_3.5/build/elbepack/daemons/soap/__init__.py", line 46, in <module>
    from cherrypy.process.plugins import SimplePlugin
ImportError: No module named 'cherrypy'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 debian/control                    | 17 +++++++++++++++--
 elbepack/daemons/soap/__init__.py |  5 ++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index a8c7ef2d..f5ce87c2 100644
--- a/debian/control
+++ b/debian/control
@@ -7,11 +7,24 @@ Build-Depends: debhelper (>= 9),
   dh-systemd,
   python-setuptools,
   python (>= 2.7~),
-  python-mako,
+  python-apt,
+  python-debian,
+  python-gpgme,
   python-lxml,
+  python-mako,
+  python-passlib,
+  python-parted,
+  python-sqlalchemy,
   python3,
-  python3-mako,
+  python3-apt,
+  python3-cherrypy3,
+  python3-debian,
+  python3-gpgme,
   python3-lxml,
+  python3-mako,
+  python3-parted,
+  python3-passlib,
+  python3-sqlalchemy,
   dia,
   asciidoc,
   xmlto,
diff --git a/elbepack/daemons/soap/__init__.py b/elbepack/daemons/soap/__init__.py
index 761501af..1f3b365b 100644
--- a/elbepack/daemons/soap/__init__.py
+++ b/elbepack/daemons/soap/__init__.py
@@ -43,7 +43,10 @@ except ImportError as e:
         pass
     print ("failed to import spyne", file=sys.stderr)
 
-from cherrypy.process.plugins import SimplePlugin
+try:
+    from cherrypy.process.plugins import SimplePlugin
+except ImportError as e:
+    print ("failed to import cherrypy", file=sys.stderr)
 
 from elbepack.projectmanager import ProjectManager
 
-- 
2.14.1




More information about the elbe-devel mailing list