def test_run_ffmpeg2vmaf_ci(self): exe = VmafConfig.root_path('ffmpeg2vmaf') line = '576 324 {root}/python/test/resource/mp4/Seeking_30_480_1050.mp4 ' \ '{root}/python/test/resource/mp4/Seeking_10_288_375.mp4'.format(root=VmafConfig.root_path()) cmd = "{exe} {line} --ci >/dev/null 2>&1".format(line=line, exe=exe) ret = run_process(cmd, shell=True) self.assertEquals(ret, 0)
def test_run_ffmpeg2vmaf_ci(self): exe = VmafConfig.root_path('python', 'vmaf', 'script', 'ffmpeg2vmaf.py') line = '576 324 {ref} {dis}'.format(ref=VmafConfig.test_resource_path('mp4', 'Seeking_30_480_1050.mp4'), dis=VmafConfig.test_resource_path('mp4', 'Seeking_10_288_375.mp4')) cmd = "{exe} {line} --ci >/dev/null 2>&1".format(line=line, exe=exe) ret = run_process(cmd, shell=True) self.assertEqual(ret, 0)
def check_program_exist(program): ''' >>> check_program_exist("xxxafasd34df") False >>> check_program_exist("xxxafasd34df f899") False >>> check_program_exist("ls") True >>> check_program_exist("ls -all") True >>> check_program_exist("pwd") True ''' try: run_process(program.split(), stdout=open(os.devnull, 'wb')) return True except OSError as e: if e.errno == errno.ENOENT: return False else: # Something else went wrong while trying to run `wget` raise