summaryrefslogtreecommitdiff
path: root/tests/test_mpv.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2022-04-23 23:05:38 +0200
committerjaseg <code@jaseg.net>2022-04-24 13:43:44 +0200
commit5f4cf600b5dcbb30c62cd6e5b804655161b32227 (patch)
treec248e3691996bbc1fa83fc63f899314f4de762f3 /tests/test_mpv.py
parent3cb1196621e5817761a08b88272135ac6b783039 (diff)
downloadpython-mpv-5f4cf600b5dcbb30c62cd6e5b804655161b32227.tar.gz
python-mpv-5f4cf600b5dcbb30c62cd6e5b804655161b32227.tar.bz2
python-mpv-5f4cf600b5dcbb30c62cd6e5b804655161b32227.zip
Add event queue overflow handling
Diffstat (limited to 'tests/test_mpv.py')
-rwxr-xr-xtests/test_mpv.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_mpv.py b/tests/test_mpv.py
index cf5e470..3fecfbd 100755
--- a/tests/test_mpv.py
+++ b/tests/test_mpv.py
@@ -659,6 +659,28 @@ class TestLifecycle(unittest.TestCase):
m.terminate()
self.disp.stop()
+ def test_wait_for_prooperty_event_overflow(self):
+ self.disp = Xvfb()
+ self.disp.start()
+ handler = mock.Mock()
+ m = mpv.MPV(vo=testvo)
+ m.play(TESTVID)
+ with self.assertRaises(mpv.EventOverflowError):
+ # level_sensitive=false needed to prevent get_property on dead
+ # handle
+ with m.prepare_and_wait_for_property('mute', cond=lambda val: time.sleep(0.001)):
+ for i in range(10000):
+ try:
+ # We really have to try hard to fill up the queue here. Simple async commands will not work,
+ # since then command_async will throw a memory error first. Property changes also do not work,
+ # since they are only processsed when the event loop is idle. This here works reliably.
+ m.command_async('script-message', 'foo', 'bar')
+ except:
+ pass
+ self.disp.stop()
+
+
+
def test_wait_for_event_shutdown(self):
self.disp = Xvfb()
self.disp.start()