Only run test_love on a single Python version to avoid collisions
This commit is contained in:
parent
d4fe9e5b36
commit
4eec2e763d
|
@ -2,19 +2,16 @@
|
||||||
"""
|
"""
|
||||||
Integration (not unit) tests for pylast.py
|
Integration (not unit) tests for pylast.py
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import TestPyLastWithLastFm
|
from .test_pylast import PY37, TestPyLastWithLastFm
|
||||||
|
|
||||||
|
|
||||||
class TestPyLastNetwork(TestPyLastWithLastFm):
|
class TestPyLastNetwork(TestPyLastWithLastFm):
|
||||||
@unittest.skipUnless(
|
@unittest.skipUnless(PY37, "Only run on Python 3.7 to avoid collisions")
|
||||||
sys.version_info[:2] == (3, 7), "Only run on Python 3.7 to avoid collisions"
|
|
||||||
)
|
|
||||||
def test_scrobble(self):
|
def test_scrobble(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
artist = "test artist"
|
artist = "test artist"
|
||||||
|
@ -24,9 +21,9 @@ class TestPyLastNetwork(TestPyLastWithLastFm):
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
self.network.scrobble(artist=artist, title=title, timestamp=timestamp)
|
self.network.scrobble(artist=artist, title=title, timestamp=timestamp)
|
||||||
|
time.sleep(1) # Delay, for Last.fm latency. TODO Can this be removed later?
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
time.sleep(1) # Delay, for Last.fm latency. TODO Can this be removed later?
|
|
||||||
# limit=2 to ignore now-playing:
|
# limit=2 to ignore now-playing:
|
||||||
last_scrobble = lastfm_user.get_recent_tracks(limit=2)[0]
|
last_scrobble = lastfm_user.get_recent_tracks(limit=2)[0]
|
||||||
self.assertEqual(str(last_scrobble.track.artist).lower(), artist)
|
self.assertEqual(str(last_scrobble.track.artist).lower(), artist)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
Integration (not unit) tests for pylast.py
|
Integration (not unit) tests for pylast.py
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -12,6 +13,9 @@ from flaky import flaky
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
|
|
||||||
|
PY37 = sys.version_info[:2] == (3, 7)
|
||||||
|
|
||||||
|
|
||||||
def load_secrets():
|
def load_secrets():
|
||||||
secrets_file = "test_pylast.yaml"
|
secrets_file = "test_pylast.yaml"
|
||||||
if os.path.isfile(secrets_file):
|
if os.path.isfile(secrets_file):
|
||||||
|
|
|
@ -6,10 +6,11 @@ import unittest
|
||||||
|
|
||||||
import pylast
|
import pylast
|
||||||
|
|
||||||
from .test_pylast import TestPyLastWithLastFm
|
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"
|
||||||
|
|
Loading…
Reference in a new issue