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