1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-19 19:01:03 +00:00

Skip lyrics tests if ChartLyrics is down

This commit is contained in:
spl0k 2019-01-13 17:26:00 +01:00
parent 25c5c8277e
commit 7cfd958eeb

View File

@ -9,6 +9,7 @@
# Distributed under terms of the GNU AGPLv3 license. # Distributed under terms of the GNU AGPLv3 license.
import os.path import os.path
import requests
import uuid import uuid
from io import BytesIO from io import BytesIO
@ -158,6 +159,12 @@ class MediaTestCase(ApiTestBase):
self._make_request('getLyrics', { 'artist': 'artist' }, error = 10) self._make_request('getLyrics', { 'artist': 'artist' }, error = 10)
self._make_request('getLyrics', { 'title': 'title' }, 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') rv, child = self._make_request('getLyrics', { 'artist': 'some really long name hoping', 'title': 'to get absolutely no result' }, tag = 'lyrics')
self.assertIsNone(child.text) self.assertIsNone(child.text)