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:
parent
31e34bd4bd
commit
36304b736b
1 changed files with 7 additions and 1 deletions
|
@ -156,7 +156,10 @@ class VirtualDevice(unittest.TestCase):
|
||||||
|
|
||||||
def done_cb(dev, res):
|
def done_cb(dev, res):
|
||||||
print("Enroll done")
|
print("Enroll done")
|
||||||
self._enrolled = dev.enroll_finish(res)
|
try:
|
||||||
|
self._enrolled = dev.enroll_finish(res)
|
||||||
|
except Exception as e:
|
||||||
|
self._enrolled = e
|
||||||
|
|
||||||
self._enroll_stage = -1
|
self._enroll_stage = -1
|
||||||
def progress_cb(dev, stage, pnt, data, error):
|
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:
|
if self._enroll_stage < 0 and not self._enrolled:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if isinstance(self._enrolled, Exception):
|
||||||
|
raise(self._enrolled)
|
||||||
|
|
||||||
nonlocal retries
|
nonlocal retries
|
||||||
self.assertLessEqual(self._enroll_stage, self.dev.get_nr_enroll_stages())
|
self.assertLessEqual(self._enroll_stage, self.dev.get_nr_enroll_stages())
|
||||||
if should_retry and retries > retry_scan:
|
if should_retry and retries > retry_scan:
|
||||||
|
|
Loading…
Reference in a new issue