From 846f2a65ae0bc9ee1c7d58a6047a9eaf71f6e6c2 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sat, 18 Jul 2020 14:21:31 +0200 Subject: Sprinkle some thread safety over event loop, add *wait_for_event --- mpv-test.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'mpv-test.py') diff --git a/mpv-test.py b/mpv-test.py index ecc4d18..5a74eb7 100755 --- a/mpv-test.py +++ b/mpv-test.py @@ -395,33 +395,32 @@ class KeyBindingTest(MpvTestCase): self.assertEqual(reg_test_fun.mpv_key_bindings, ['b', 'a']) def keypress_and_sync(key): - self.m.keypress(key) - self.m.frame_step() - self.m.wait_until_playing() + with self.m.prepare_and_wait_for_event('client_message'): + self.m.keypress(key) keypress_and_sync('a') handler1.assert_has_calls([ mock.call() ]) handler2.assert_has_calls([]) handler1.reset_mock() - keypress_and_sync('x') - keypress_and_sync('X') + self.m.keypress('x') + self.m.keypress('X') keypress_and_sync('b') handler1.assert_has_calls([ mock.call() ]) handler2.assert_has_calls([]) handler1.reset_mock() keypress_and_sync('c') - keypress_and_sync('B') + self.m.keypress('B') handler1.assert_has_calls([]) handler2.assert_has_calls([ mock.call() ]) handler2.reset_mock() reg_test_fun.unregister_mpv_key_bindings() - keypress_and_sync('a') + self.m.keypress('a') keypress_and_sync('c') - keypress_and_sync('x') - keypress_and_sync('A') + self.m.keypress('x') + self.m.keypress('A') handler1.assert_has_calls([]) handler2.assert_has_calls([ mock.call() ]) -- cgit