From: Christopher Allan Webber Date: Thu, 4 Feb 2016 23:40:28 +0000 (-0800) Subject: Issue #5349: Submission tests fail confusingly on missing dependency X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=5573c41054236b583d932ebe730e8b493bf52f37;p=mediagoblin.git Issue #5349: Submission tests fail confusingly on missing dependency They gave a DetachedInstanceError, despite being totally unrelated to anything in database-land! --- diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py index 0ec49ec7..9a4f4645 100644 --- a/mediagoblin/tests/test_submission.py +++ b/mediagoblin/tests/test_submission.py @@ -52,6 +52,21 @@ FORM_CONTEXT = ['mediagoblin/submit/start.html', 'submit_form'] REQUEST_CONTEXT = ['mediagoblin/user_pages/user.html', 'request'] +SKIP_AUDIO = False +SKIP_VIDEO = False + +try: + import gi.repository.Gst +except ImportError: + SKIP_AUDIO = True + SKIP_VIDEO = True + +try: + import scikits.audiolab +except ImportError: + SKIP_AUDIO = True + + class TestSubmission: @pytest.fixture(autouse=True) def setup(self, test_app): @@ -389,14 +404,20 @@ class TestSubmission: media = self.check_media(None, {"title": u"With GPS data"}, 1) assert media.get_location.position["latitude"] == 59.336666666666666 + @pytest.mark.skipif(SKIP_AUDIO, + reason="Dependencies for audio not met") def test_audio(self): with create_av(make_audio=True) as path: self.check_normal_upload('Audio', path) + @pytest.mark.skipif(SKIP_VIDEO, + reason="Dependencies for video not met") def test_video(self): with create_av(make_video=True) as path: self.check_normal_upload('Video', path) + @pytest.mark.skipif(SKIP_AUDIO or SKIP_VIDEO, + reason="Dependencies for audio or video not met") def test_audio_and_video(self): with create_av(make_audio=True, make_video=True) as path: self.check_normal_upload('Audio and Video', path)