Print a more helpful message when the system lacks
the dependencies needed to run this unittest.

CC: Nishanth Aravamudan <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 tko/job_serializer_unittest.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tko/job_serializer_unittest.py b/tko/job_serializer_unittest.py
index c3f5566..0a2b96c 100755
--- a/tko/job_serializer_unittest.py
+++ b/tko/job_serializer_unittest.py
@@ -27,7 +27,16 @@ os.chdir(module_dir)
 commands.getoutput('make')
 os.chdir(cwd)
 
-from autotest.tko import tko_pb2
+try:
+    from autotest.tko import tko_pb2
+except ImportError:
+    print("Error importing tko_pb2")
+    print("Please install the protocol buffer compiler "
+          "and the protocol buffer py library for your distro.")
+    print("installation_support/autotest-install-packages-deps "
+          "can help you with installing deps required for "
+          "server operation and unittests.")
+    sys.exit(1)
 from autotest.tko import job_serializer
 from autotest.tko import models
 from autotest.client.shared.test_utils import unittest
-- 
1.8.1.4

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to