def test_no_ffmpeg(self, popen_mock): def raise_no_app(cmd_args, **kwargs): if 'ffmpeg' in (x.lower() for x in cmd_args): raise OSError(2, 'ignored') popen_mock.side_effect = raise_no_app self.assertRaisesRegexp(SushiError, '[fF][fF][mM][pP][eE][gG]', lambda: SCXviD.make_keyframes('video.mkv', 'keyframes.txt'))
def test_no_scxvid(self, popen_mock): def raise_no_app(cmd_args, **kwargs): if 'scxvid' in (x.lower() for x in cmd_args): raise OSError(2, 'ignored') return mock.Mock() popen_mock.side_effect = raise_no_app self.assertRaisesRegexp(SushiError, '[sS][cC][xX][vV][iI][dD]', lambda: SCXviD.make_keyframes('video.mkv', 'keyframes.txt'))
def test_make_keyframes(self, popen_mock): SCXviD.make_keyframes('video.mkv', 'keyframes.txt') self.assertTrue('ffmpeg' in (x.lower() for x in popen_mock.call_args_list[0][0][0])) self.assertTrue('scxvid' in (x.lower() for x in popen_mock.call_args_list[1][0][0]))