From 2f1a7ae905886fb1441d45b97c8e9952a1c3a878 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 5 May 2022 09:45:32 +1000 Subject: test: swap the axis checks for an iterator-based approach This ensures we get a StopIteration exception if we don't have the events we expect - previously we'd get a false positive on this test if we had no motion events after the first one. Signed-off-by: Peter Hutterer Reviewed-by: Aaron Skomra --- test/test_wacom.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test_wacom.py b/test/test_wacom.py index b92901c..d3e315d 100644 --- a/test/test_wacom.py +++ b/test/test_wacom.py @@ -190,11 +190,13 @@ def test_axis_updates(mainloop, opts, axis): mainloop.run() logger.debug(f"We have {len(monitor.events)} events") - # ignore the initial proximity event since all axes change there - # by necessity - first = {name: getattr(monitor.events[1].axes, name) for name in map} + events = iter(monitor.events) + # Ignore the proximity event since all axes change there by necessity + _ = next(events) - for e in monitor.events[2:]: + first = {name: getattr(next(events).axes, name) for name in map} + + for e in events: current = {name: getattr(e.axes, name) for name in map} for name in map: if name == axis: -- cgit v1.2.1