tests/virtual-device: Properly handle exceptions on enroll callback

We need to get them back to the caller function to be caught by the test
suite.
This commit is contained in:
Marco Trevisan (Treviño) 2021-01-27 15:02:17 +01:00
parent 31e34bd4bd
commit 36304b736b

View file

@ -156,7 +156,10 @@ class VirtualDevice(unittest.TestCase):
def done_cb(dev, res):
print("Enroll done")
try:
self._enrolled = dev.enroll_finish(res)
except Exception as e:
self._enrolled = e
self._enroll_stage = -1
def progress_cb(dev, stage, pnt, data, error):
@ -172,6 +175,9 @@ class VirtualDevice(unittest.TestCase):
if self._enroll_stage < 0 and not self._enrolled:
return True
if isinstance(self._enrolled, Exception):
raise(self._enrolled)
nonlocal retries
self.assertLessEqual(self._enroll_stage, self.dev.get_nr_enroll_stages())
if should_retry and retries > retry_scan: