Disable python test if required libraries are missing
authorMichele Tartara <mtartara@google.com>
Fri, 21 Jun 2013 10:51:58 +0000 (12:51 +0200)
committerMichele Tartara <mtartara@google.com>
Fri, 21 Jun 2013 12:16:07 +0000 (14:16 +0200)
Some python libraries are only needed for the tests, but not for running
Ganeti. If those libraries are missing, just disable the Python tests.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

Makefile.am
configure.ac

index e6eabfd..53c37ad 100644 (file)
@@ -1148,6 +1148,9 @@ TEST_FILES = \
        test/py/import-export_unittest-helper
 
 
        test/py/import-export_unittest-helper
 
 
+if PY_NODEV
+python_tests=
+else
 python_tests = \
        doc/examples/rapi_testutils.py \
        test/py/cfgupgrade_unittest.py \
 python_tests = \
        doc/examples/rapi_testutils.py \
        test/py/cfgupgrade_unittest.py \
@@ -1228,6 +1231,7 @@ python_tests = \
        test/py/pycurl_reset_unittest.py \
        test/py/qa.qa_config_unittest.py \
        test/py/tempfile_fork_unittest.py
        test/py/pycurl_reset_unittest.py \
        test/py/qa.qa_config_unittest.py \
        test/py/tempfile_fork_unittest.py
+endif
 
 haskell_tests = test/hs/htest
 
 
 haskell_tests = test/hs/htest
 
index df8f684..956b4ed 100644 (file)
@@ -776,10 +776,25 @@ AC_PYTHON_MODULE(pyinotify, t)
 AC_PYTHON_MODULE(pycurl, t)
 AC_PYTHON_MODULE(bitarray, t)
 AC_PYTHON_MODULE(ipaddr, t)
 AC_PYTHON_MODULE(pycurl, t)
 AC_PYTHON_MODULE(bitarray, t)
 AC_PYTHON_MODULE(ipaddr, t)
-AC_PYTHON_MODULE(yaml, t)
 AC_PYTHON_MODULE(affinity)
 AC_PYTHON_MODULE(paramiko)
 
 AC_PYTHON_MODULE(affinity)
 AC_PYTHON_MODULE(paramiko)
 
+# Development-only Python modules
+PY_NODEV=
+AC_PYTHON_MODULE(yaml)
+if test $HAVE_PYMOD_YAML == "no"; then
+  PY_NODEV="$PY_NODEV yaml"
+fi
+
+if test -n "$PY_NODEV"; then
+  AC_MSG_WARN(m4_normalize([Required development modules ($PY_NODEV) were not
+                            found, you won't be able to run Python unittests]))
+else
+   AC_MSG_NOTICE([Python development modules found, unittests enabled])
+fi
+AC_SUBST(PY_NODEV)
+AM_CONDITIONAL([PY_NODEV], [test -n $PY_NODEV])
+
 AC_CONFIG_FILES([ Makefile ])
 
 AC_OUTPUT
 AC_CONFIG_FILES([ Makefile ])
 
 AC_OUTPUT