From 7cfd958eebee432c2f99419393b9aac525972f69 Mon Sep 17 00:00:00 2001 From: spl0k Date: Sun, 13 Jan 2019 17:26:00 +0100 Subject: [PATCH] Skip lyrics tests if ChartLyrics is down --- tests/api/test_media.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/api/test_media.py b/tests/api/test_media.py index dab5380..142ca80 100644 --- a/tests/api/test_media.py +++ b/tests/api/test_media.py @@ -9,6 +9,7 @@ # Distributed under terms of the GNU AGPLv3 license. import os.path +import requests import uuid from io import BytesIO @@ -158,6 +159,12 @@ class MediaTestCase(ApiTestBase): self._make_request('getLyrics', { 'artist': 'artist' }, error = 10) self._make_request('getLyrics', { 'title': 'title' }, error = 10) + # Potentially skip the tests if ChartLyrics is down (which happens quite often) + try: + requests.get('http://api.chartlyrics.com/', timeout = 5) + except requests.exceptions.Timeout: + self.skipTest('ChartLyrics down') + rv, child = self._make_request('getLyrics', { 'artist': 'some really long name hoping', 'title': 'to get absolutely no result' }, tag = 'lyrics') self.assertIsNone(child.text)