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.
This commit is contained in:
parent
400053e8d3
commit
9c33d0117e
1 changed files with 7 additions and 3 deletions
10
mpv-test.py
10
mpv-test.py
|
|
@ -547,20 +547,24 @@ class TestLifecycle(unittest.TestCase):
|
||||||
m.terminate()
|
m.terminate()
|
||||||
handler.assert_not_called()
|
handler.assert_not_called()
|
||||||
|
|
||||||
|
@devnull_libmpv()
|
||||||
def test_log_handler(self):
|
def test_log_handler(self):
|
||||||
handler = mock.Mock()
|
handler = mock.Mock()
|
||||||
self.disp = Xvfb()
|
self.disp = Xvfb()
|
||||||
self.disp.start()
|
self.disp.start()
|
||||||
m = mpv.MPV(video=False, log_handler=handler)
|
m = mpv.MPV(log_handler=handler)
|
||||||
m.play(TESTVID)
|
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.wait_for_playback()
|
||||||
m.terminate()
|
m.terminate()
|
||||||
for call in handler.mock_calls:
|
for call in handler.mock_calls:
|
||||||
_1, (a, b, c), _2 = call
|
_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
|
break
|
||||||
else:
|
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()
|
self.disp.stop()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue