diff --git a/tests/test_network.py b/tests/test_network.py index 3ce4951..448e535 100755 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -7,10 +7,11 @@ import unittest import pylast -from .test_pylast import TestPyLastWithLastFm +from .test_pylast import PY37, TestPyLastWithLastFm class TestPyLastNetwork(TestPyLastWithLastFm): + @unittest.skipUnless(PY37, "Only run on Python 3.7 to avoid collisions") def test_scrobble(self): # Arrange artist = "test artist" @@ -20,6 +21,7 @@ class TestPyLastNetwork(TestPyLastWithLastFm): # Act self.network.scrobble(artist=artist, title=title, timestamp=timestamp) + time.sleep(1) # Delay, for Last.fm latency. TODO Can this be removed later? # Assert # limit=2 to ignore now-playing: diff --git a/tests/test_pylast.py b/tests/test_pylast.py index bb88225..b417fb8 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -3,6 +3,7 @@ Integration (not unit) tests for pylast.py """ import os +import sys import time import unittest @@ -12,6 +13,9 @@ from flaky import flaky import pylast +PY37 = sys.version_info[:2] == (3, 7) + + def load_secrets(): secrets_file = "test_pylast.yaml" if os.path.isfile(secrets_file): diff --git a/tests/test_track.py b/tests/test_track.py index b65d6be..bce28db 100755 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -6,10 +6,11 @@ import unittest import pylast -from .test_pylast import TestPyLastWithLastFm +from .test_pylast import PY37, TestPyLastWithLastFm class TestPyLastTrack(TestPyLastWithLastFm): + @unittest.skipUnless(PY37, "Only run on Python 3.7 to avoid collisions") def test_love(self): # Arrange artist = "Test Artist" diff --git a/tox.ini b/tox.ini index a84fb2a..9e62b74 100644 --- a/tox.ini +++ b/tox.ini @@ -14,8 +14,9 @@ deps = mock ipdb pytest-cov + pytest-random-order flaky -commands = pytest -v -s -W all --cov pylast --cov-report term-missing {posargs} +commands = pytest -v -s -W all --cov pylast --cov-report term-missing --random-order {posargs} [testenv:venv] deps = ipdb