summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-01-22 11:48:47 +0100
committerjaseg <git@jaseg.de>2024-01-22 11:53:02 +0100
commit141ec7d372c8d536c208c39bb89132d69aa1b36c (patch)
tree219adac86c26d51a08a60984e8696e050e77131c /tests
parentc52a07e86279f8a892aee4b2adae2a03481f7bce (diff)
downloadpython-mpv-141ec7d372c8d536c208c39bb89132d69aa1b36c.tar.gz
python-mpv-141ec7d372c8d536c208c39bb89132d69aa1b36c.tar.bz2
python-mpv-141ec7d372c8d536c208c39bb89132d69aa1b36c.zip
mpv.py: Add play_context convenience function
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_mpv.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_mpv.py b/tests/test_mpv.py
index 74999ad..9cc688d 100755
--- a/tests/test_mpv.py
+++ b/tests/test_mpv.py
@@ -643,6 +643,26 @@ class TestStreams(unittest.TestCase):
m.terminate()
disp.stop()
+ def test_play_context(self):
+ handler = mock.Mock()
+
+ disp = Display()
+ disp.start()
+ m = mpv.MPV(vo=testvo)
+ def cb(evt):
+ handler(evt.as_dict(decoder=mpv.lazy_decoder))
+ m.register_event_callback(cb)
+
+ with m.play_context() as write:
+ with open(TESTVID, 'rb') as f:
+ write(f.read(100))
+ write(f.read(1000))
+ write(f.read())
+
+ m.wait_for_playback()
+ handler.assert_any_call({'event': 'end-file', 'reason': 'eof', 'playlist_entry_id': 1})
+ m.terminate()
+ disp.stop()
class TestLifecycle(unittest.TestCase):