Skip tests which fail due to the (still) broken Last.fm API
This commit is contained in:
parent
6ecba676bc
commit
950c2e78ca
33
.gitignore
vendored
33
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
|
||||||
# C extensions
|
# C extensions
|
||||||
*.so
|
*.so
|
||||||
|
@ -8,11 +9,12 @@ __pycache__/
|
||||||
# Distribution / packaging
|
# Distribution / packaging
|
||||||
.Python
|
.Python
|
||||||
env/
|
env/
|
||||||
bin/
|
|
||||||
build/
|
build/
|
||||||
develop-eggs/
|
develop-eggs/
|
||||||
dist/
|
dist/
|
||||||
|
downloads/
|
||||||
eggs/
|
eggs/
|
||||||
|
.eggs/
|
||||||
lib/
|
lib/
|
||||||
lib64/
|
lib64/
|
||||||
parts/
|
parts/
|
||||||
|
@ -22,6 +24,12 @@ var/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
# Usually these files are written by a python script from a template
|
||||||
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
*.manifest
|
||||||
|
*.spec
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
pip-delete-this-directory.txt
|
pip-delete-this-directory.txt
|
||||||
|
@ -30,33 +38,22 @@ pip-delete-this-directory.txt
|
||||||
htmlcov/
|
htmlcov/
|
||||||
.tox/
|
.tox/
|
||||||
.coverage
|
.coverage
|
||||||
|
.coverage.*
|
||||||
.cache
|
.cache
|
||||||
nosetests.xml
|
nosetests.xml
|
||||||
coverage.xml
|
coverage.xml
|
||||||
output.html
|
*,cover
|
||||||
output.xml
|
.hypothesis/
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
*.pot
|
||||||
# Mr Developer
|
|
||||||
.mr.developer.cfg
|
|
||||||
.project
|
|
||||||
.pydevproject
|
|
||||||
|
|
||||||
# Rope
|
|
||||||
.ropeproject
|
|
||||||
|
|
||||||
# Django stuff:
|
# Django stuff:
|
||||||
*.log
|
*.log
|
||||||
*.pot
|
|
||||||
|
|
||||||
# Sphinx documentation
|
# Sphinx documentation
|
||||||
docs/_build/
|
docs/_build/
|
||||||
|
|
||||||
# Test files
|
# PyBuilder
|
||||||
test_pylast.yaml
|
target/
|
||||||
lastfm.txt.pkl
|
|
||||||
secrets.sh
|
|
||||||
|
|
||||||
.dir-locals.el
|
|
|
@ -30,6 +30,21 @@ def load_secrets():
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
|
def handle_lastfm_exceptions(f):
|
||||||
|
def wrapper(*args, **kw):
|
||||||
|
try:
|
||||||
|
return f(*args, **kw)
|
||||||
|
except pylast.WSError as e:
|
||||||
|
if (str(e) == "Invalid Method - "
|
||||||
|
"No method with that name in this package"):
|
||||||
|
msg = "Ignore broken Last.fm API: " + str(e)
|
||||||
|
print(msg)
|
||||||
|
pytest.skip(msg)
|
||||||
|
else:
|
||||||
|
raise(e)
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
@flaky(max_runs=5, min_passes=1)
|
@flaky(max_runs=5, min_passes=1)
|
||||||
class TestPyLast(unittest.TestCase):
|
class TestPyLast(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -87,6 +102,7 @@ class TestPyLast(unittest.TestCase):
|
||||||
last_scrobble = lastfm_user.get_recent_tracks(limit=2)[0]
|
last_scrobble = lastfm_user.get_recent_tracks(limit=2)[0]
|
||||||
self.assertNotEqual(str(last_scrobble.timestamp), str(timestamp))
|
self.assertNotEqual(str(last_scrobble.timestamp), str(timestamp))
|
||||||
|
|
||||||
|
@handle_lastfm_exceptions
|
||||||
def test_add_album(self):
|
def test_add_album(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
library = pylast.Library(user=self.username, network=self.network)
|
library = pylast.Library(user=self.username, network=self.network)
|
||||||
|
|
Loading…
Reference in a new issue