py: unittests: Fix test_sleep()
Waiting for 0.5 secs and expecting that the requests have been completed is... bad. Fix the test case by using cam.read_event() as a blocking wait, and wait until we have received all the requests that we queued. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
207e52b8d3
commit
9f5b790800
1 changed files with 10 additions and 4 deletions
|
@ -161,7 +161,7 @@ class AllocatorTestMethods(CameraTesterBase):
|
|||
|
||||
|
||||
class SimpleCaptureMethods(CameraTesterBase):
|
||||
def test_sleep(self):
|
||||
def test_blocking(self):
|
||||
cm = self.cm
|
||||
cam = self.cam
|
||||
|
||||
|
@ -207,11 +207,17 @@ class SimpleCaptureMethods(CameraTesterBase):
|
|||
reqs = None
|
||||
gc.collect()
|
||||
|
||||
time.sleep(0.5)
|
||||
reqs = []
|
||||
|
||||
reqs = cm.get_ready_requests()
|
||||
while True:
|
||||
cm.read_event()
|
||||
|
||||
self.assertTrue(len(reqs) == num_bufs)
|
||||
ready_reqs = cm.get_ready_requests()
|
||||
|
||||
reqs += ready_reqs
|
||||
|
||||
if len(reqs) == num_bufs:
|
||||
break
|
||||
|
||||
for i, req in enumerate(reqs):
|
||||
self.assertTrue(i == req.cookie)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue