tests: Return skip error if import fails

Rather than backtracing, just print the exception and return a skip
error if the import fails.
This commit is contained in:
Benjamin Berg 2020-01-15 18:42:54 +01:00
parent 5faf8498d9
commit 5ac770c614

View file

@ -1,20 +1,24 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import gi
gi.require_version('FPrint', '2.0')
from gi.repository import FPrint, GLib, Gio
import os
import sys import sys
import unittest try:
import socket import gi
import struct gi.require_version('FPrint', '2.0')
import subprocess from gi.repository import FPrint, GLib, Gio
import shutil
import glob import os
import cairo import sys
import tempfile 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 # Re-run the test with the passed wrapper if set
wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER') wrapper = os.getenv('LIBFPRINT_TEST_WRAPPER')