Merge pull request #293 from pylast/fix-test

Fix the build
This commit is contained in:
Hugo 2019-02-03 14:23:20 +02:00 committed by GitHub
commit d9c086f8cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@
""" """
Integration (not unit) tests for pylast.py Integration (not unit) tests for pylast.py
""" """
import time
import unittest import unittest
import pylast import pylast
@ -10,7 +11,6 @@ from .test_pylast import PY37, TestPyLastWithLastFm
class TestPyLastTrack(TestPyLastWithLastFm): class TestPyLastTrack(TestPyLastWithLastFm):
@unittest.skipUnless(PY37, "Only run on Python 3.7 to avoid collisions")
def test_love(self): def test_love(self):
# Arrange # Arrange
artist = "Test Artist" artist = "Test Artist"
@ -20,12 +20,14 @@ class TestPyLastTrack(TestPyLastWithLastFm):
# Act # Act
track.love() track.love()
time.sleep(1) # Delay, for Last.fm latency. TODO Can this be removed later?
# Assert # Assert
loved = lastfm_user.get_loved_tracks(limit=1) loved = lastfm_user.get_loved_tracks(limit=1)
self.assertEqual(str(loved[0].track.artist).lower(), "test artist") self.assertEqual(str(loved[0].track.artist).lower(), "test artist")
self.assertEqual(str(loved[0].track.title).lower(), "test title") self.assertEqual(str(loved[0].track.title).lower(), "test title")
@unittest.skipUnless(PY37, "Only run on Python 3.7 to avoid collisions")
def test_unlove(self): def test_unlove(self):
# Arrange # Arrange
artist = pylast.Artist("Test Artist", self.network) artist = pylast.Artist("Test Artist", self.network)