mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
tests: Ensure python tests exit with error on every exception
We ignored assertions happening on callbacks as they only raise exceptions that does not stop the execution. So ensure that this is happening in all the tests as synaptics was doing already
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import gi
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
import cairo
|
||||
import sys
|
||||
import traceback
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print("Please specify exactly one argument, the output location for the capture image")
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
c = FPrint.Context()
|
||||
|
||||
6
tests/goodixmoc/custom.py
Normal file → Executable file
6
tests/goodixmoc/custom.py
Normal file → Executable file
@@ -1,9 +1,15 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import traceback
|
||||
import sys
|
||||
import gi
|
||||
|
||||
gi.require_version('FPrint', '2.0')
|
||||
from gi.repository import FPrint, GLib
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
c = FPrint.Context()
|
||||
|
||||
@@ -22,6 +22,9 @@ except Exception as e:
|
||||
|
||||
FPrint = None
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
ctx = GLib.main_context_default()
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ except Exception as e:
|
||||
|
||||
FPrint = None
|
||||
|
||||
# Exit with error on any exception, included those happening in async callbacks
|
||||
sys.excepthook = lambda *args: (traceback.print_exception(*args), sys.exit(1))
|
||||
|
||||
def load_image(img):
|
||||
png = cairo.ImageSurface.create_from_png(img)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user