catch OSError and skip task tests
This commit is contained in:
Родитель
98647143b1
Коммит
b070e64988
|
@ -136,5 +136,5 @@ class Video(object):
|
|||
# If in the future we want to check for an ffmpeg version
|
||||
# this is the place to do it.
|
||||
return bool(version_re.match(output))
|
||||
except subprocess.CalledProcessError:
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
pass
|
||||
|
|
|
@ -20,6 +20,10 @@ def resize_video(src, instance, *kw):
|
|||
"""
|
||||
log.info('[1@None] Encoding video %s' % instance.pk)
|
||||
video = Video(src)
|
||||
if not video.encoder_available():
|
||||
log.info('Video encoder not available for %s' % instance.pk)
|
||||
return
|
||||
|
||||
video.get_meta()
|
||||
if not video.is_valid():
|
||||
log.info('Video is not valid for %s' % instance.pk)
|
||||
|
|
|
@ -87,6 +87,8 @@ class TestTask(amo.tests.TestCase):
|
|||
self.mock.thumbnail_path = tempfile.mkstemp()[1]
|
||||
self.mock.image_path = tempfile.mkstemp()[1]
|
||||
self.mock.pk = 1
|
||||
if not ffmpeg.Video('').encoder_available():
|
||||
raise SkipTest
|
||||
|
||||
def test_resize_video(self):
|
||||
resize_video(files['good'], self.mock)
|
||||
|
|
Загрузка…
Ссылка в новой задаче