Blame SOURCES/0179-tests-Return-skip-error-if-import-fails.patch

73b847
From 871d07cc1e6533cf60950ebc75825e313c96e42b Mon Sep 17 00:00:00 2001
73b847
From: Benjamin Berg <bberg@redhat.com>
73b847
Date: Wed, 15 Jan 2020 18:42:54 +0100
73b847
Subject: [PATCH 179/181] tests: Return skip error if import fails
73b847
73b847
Rather than backtracing, just print the exception and return a skip
73b847
error if the import fails.
73b847
---
73b847
 tests/virtual-image.py | 32 ++++++++++++++++++--------------
73b847
 1 file changed, 18 insertions(+), 14 deletions(-)
73b847
73b847
diff --git a/tests/virtual-image.py b/tests/virtual-image.py
73b847
index a6bf6d2..da77eee 100755
73b847
--- a/tests/virtual-image.py
73b847
+++ b/tests/virtual-image.py
73b847
@@ -1,20 +1,24 @@
73b847
 #!/usr/bin/env python3
73b847
 
73b847
-
73b847
-import gi
73b847
-gi.require_version('FPrint', '2.0')
73b847
-from gi.repository import FPrint, GLib, Gio
73b847
-
73b847
-import os
73b847
 import sys
73b847
-import unittest
73b847
-import socket
73b847
-import struct
73b847
-import subprocess
73b847
-import shutil
73b847
-import glob
73b847
-import cairo
73b847
-import tempfile
73b847
+try:
73b847
+    import gi
73b847
+    gi.require_version('FPrint', '2.0')
73b847
+    from gi.repository import FPrint, GLib, Gio
73b847
+
73b847
+    import os
73b847
+    import sys
73b847
+    import unittest
73b847
+    import socket
73b847
+    import struct
73b847
+    import subprocess
73b847
+    import shutil
73b847
+    import glob
73b847
+    import cairo
73b847
+    import tempfile
73b847
+except Exception as e:
73b847
+    print("Missing dependencies: %s" % str(e))
73b847
+    sys.exit(77)
73b847
 
73b847
 # Re-run the test with the passed wrapper if set
73b847
 wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')
73b847
-- 
73b847
2.24.1
73b847