[libcamera-devel,v4,04/15] py: unittests.py: Use new events support
diff mbox series

Message ID 20230309142601.70556-5-tomi.valkeinen@ideasonboard.com
State Superseded
Headers show
Series
  • py: New python bindings event handling
Related show

Commit Message

Tomi Valkeinen March 9, 2023, 2:25 p.m. UTC
Update the Python unittests to use the new event model. The unittests
expect a controlled environment to be run on, and the tests will fail if
we get any other event but RequestCompleted (e.g. camera connected).

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/py/unittests.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch
diff mbox series

diff --git a/test/py/unittests.py b/test/py/unittests.py
index 794e46be..fab791d1 100755
--- a/test/py/unittests.py
+++ b/test/py/unittests.py
@@ -201,9 +201,9 @@  class SimpleCaptureMethods(CameraTesterBase):
             if not events:
                 continue
 
-            ready_reqs = cm.get_ready_requests()
-
-            reqs += ready_reqs
+            for ev in cm.get_events():
+                self.assertEqual(ev.type, libcam.Event.Type.RequestCompleted)
+                reqs.append(ev.request)
 
             if len(reqs) == num_bufs:
                 break
@@ -267,9 +267,9 @@  class SimpleCaptureMethods(CameraTesterBase):
         while running:
             events = sel.select()
             for key, _ in events:
-                ready_reqs = cm.get_ready_requests()
-
-                reqs += ready_reqs
+                for ev in cm.get_events():
+                    self.assertEqual(ev.type, libcam.Event.Type.RequestCompleted)
+                    reqs.append(ev.request)
 
                 if len(reqs) == num_bufs:
                     running = False