summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-03-26 14:18:34 +0100
committerjaseg <git@jaseg.de>2022-03-26 14:23:04 +0100
commit0cda09c62872542b4b8427aaaa9600b8fd8d7d2f (patch)
treed24c18a7f0f45d03b44980aab8d6ea991fbf1ff4 /tests
parenta7e61c9362bf39aaede0ac049e03d6b3cf8bb729 (diff)
downloadpython-mpv-0cda09c62872542b4b8427aaaa9600b8fd8d7d2f.tar.gz
python-mpv-0cda09c62872542b4b8427aaaa9600b8fd8d7d2f.tar.bz2
python-mpv-0cda09c62872542b4b8427aaaa9600b8fd8d7d2f.zip
Add timeouts and error forwarding to wait_for_{property,event} conditions
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_mpv.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_mpv.py b/tests/test_mpv.py
index b4bbf0d..1f7af3a 100755
--- a/tests/test_mpv.py
+++ b/tests/test_mpv.py
@@ -380,6 +380,31 @@ class KeyBindingTest(MpvTestCase):
self.assertNotIn(b('b'), self.m._key_binding_handlers)
self.assertIn(b('c'), self.m._key_binding_handlers)
+ def test_wait_for_event_error_forwarding(self):
+ self.m.play(TESTVID)
+
+ def check(evt):
+ raise ValueError('fnord')
+
+ with self.assertRaises(ValueError):
+ self.m.wait_for_event('end_file', cond=check)
+
+ def test_wait_for_property_error_forwarding(self):
+ def run():
+ nonlocal self
+ self.m.wait_until_playing()
+ self.m.mute = True
+ t = threading.Thread(target=run, daemon=True)
+ t.start()
+
+ def cond(mute):
+ if mute:
+ raise ValueError('fnord')
+
+ with self.assertRaises(ValueError):
+ self.m.play(TESTVID)
+ self.m.wait_for_property('mute', cond=cond)
+
def test_register_simple_decorator_fun_chaining(self):
self.m.loop = 'inf'
self.m.play(TESTVID)