summaryrefslogtreecommitdiff
path: root/mpv-test.py
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2020-07-15 21:49:50 +0200
committerjaseg <code@jaseg.net>2020-07-15 22:04:37 +0200
commit9c33d0117e5984bff5a2650d8f69202dd7462b06 (patch)
treebe932418860a2f1f73295d9d3e2a1b4464100d01 /mpv-test.py
parent400053e8d3052755aad3fab38f61dd8e46156715 (diff)
downloadpython-mpv-9c33d0117e5984bff5a2650d8f69202dd7462b06.tar.gz
python-mpv-9c33d0117e5984bff5a2650d8f69202dd7462b06.tar.bz2
python-mpv-9c33d0117e5984bff5a2650d8f69202dd7462b06.zip
tests: Fix test_log_handler for current master
The current mpv master changes default log output, breaking this test. To be future-proof, it now emits its own message through the print-text command.
Diffstat (limited to 'mpv-test.py')
-rwxr-xr-xmpv-test.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/mpv-test.py b/mpv-test.py
index 75a67fb..2a0bc41 100755
--- a/mpv-test.py
+++ b/mpv-test.py
@@ -547,20 +547,24 @@ class TestLifecycle(unittest.TestCase):
m.terminate()
handler.assert_not_called()
+ @devnull_libmpv()
def test_log_handler(self):
handler = mock.Mock()
self.disp = Xvfb()
self.disp.start()
- m = mpv.MPV(video=False, log_handler=handler)
+ m = mpv.MPV(log_handler=handler)
m.play(TESTVID)
+ # Wait for playback to start
+ m.wait_for_property('core-idle', lambda x: not x)
+ m.command("print-text", 'This is a python-mpv test')
m.wait_for_playback()
m.terminate()
for call in handler.mock_calls:
_1, (a, b, c), _2 = call
- if a == 'info' and b == 'cplayer' and c.startswith('Playing: '):
+ if a == 'info' and b == 'cplayer' and 'This is a python-mpv test' in c:
break
else:
- self.fail('"Playing: foo..." call not found in log handler calls: '+','.join(repr(call) for call in handler.mock_calls))
+ self.fail('"Test log entry not found in log handler calls: '+','.join(repr(call) for call in handler.mock_calls))
self.disp.stop()