From 9c33d0117e5984bff5a2650d8f69202dd7462b06 Mon Sep 17 00:00:00 2001 From: jaseg Date: Wed, 15 Jul 2020 21:49:50 +0200 Subject: 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. --- mpv-test.py | 10 +++++++--- 1 file 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() -- cgit