diff --git a/tests/test_album.py b/tests/test_album.py index a44305b..dd76de8 100755 --- a/tests/test_album.py +++ b/tests/test_album.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastAlbum(PyLastTestCase): +class TestPyLastAlbum(TestPyLastWithLastFm): def test_album_tags_are_topitems(self): # Arrange diff --git a/tests/test_artist.py b/tests/test_artist.py index 58612ea..a4f2cfd 100755 --- a/tests/test_artist.py +++ b/tests/test_artist.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastArtist(PyLastTestCase): +class TestPyLastArtist(TestPyLastWithLastFm): def test_repr(self): # Arrange diff --git a/tests/test_country.py b/tests/test_country.py index 4f6b25f..a755db3 100755 --- a/tests/test_country.py +++ b/tests/test_country.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastCountry(PyLastTestCase): +class TestPyLastCountry(TestPyLastWithLastFm): def test_country_is_hashable(self): # Arrange diff --git a/tests/test_library.py b/tests/test_library.py index ca87c8e..a0aceb5 100755 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastLibrary(PyLastTestCase): +class TestPyLastLibrary(TestPyLastWithLastFm): def test_repr(self): # Arrange diff --git a/tests/test_librefm.py b/tests/test_librefm.py index ab3ea3f..a19e86a 100755 --- a/tests/test_librefm.py +++ b/tests/test_librefm.py @@ -8,11 +8,11 @@ from flaky import flaky import pylast -from .test_pylast import load_secrets +from .test_pylast import PyLastTestCase, load_secrets @flaky(max_runs=5, min_passes=1) -class TestPyLastWithLibreFm(unittest.TestCase): +class TestPyLastWithLibreFm(PyLastTestCase): """Own class for Libre.fm because we don't need the Last.fm setUp""" def test_libre_fm(self): diff --git a/tests/test_network.py b/tests/test_network.py index 0e55bc3..4cd1a16 100755 --- a/tests/test_network.py +++ b/tests/test_network.py @@ -7,10 +7,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastNetwork(PyLastTestCase): +class TestPyLastNetwork(TestPyLastWithLastFm): def test_scrobble(self): # Arrange diff --git a/tests/test_pylast.py b/tests/test_pylast.py index c09ad27..e3193a0 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -30,9 +30,18 @@ def load_secrets(): return doc -@flaky(max_runs=5, min_passes=1) class PyLastTestCase(unittest.TestCase): + def assert_startswith(self, str, prefix, start=None, end=None): + self.assertTrue(str.startswith(prefix, start, end)) + + def assert_endswith(self, str, suffix, start=None, end=None): + self.assertTrue(str.endswith(suffix, start, end)) + + +@flaky(max_runs=5, min_passes=1) +class TestPyLastWithLastFm(PyLastTestCase): + secrets = None def unix_timestamp(self): @@ -52,12 +61,6 @@ class PyLastTestCase(unittest.TestCase): api_key=API_KEY, api_secret=API_SECRET, username=self.username, password_hash=password_hash) - def assert_startswith(self, str, prefix, start=None, end=None): - self.assertTrue(str.startswith(prefix, start, end)) - - def assert_endswith(self, str, suffix, start=None, end=None): - self.assertTrue(str.endswith(suffix, start, end)) - def helper_is_thing_hashable(self, thing): # Arrange things = set() diff --git a/tests/test_tag.py b/tests/test_tag.py index e56aac5..d3980fb 100755 --- a/tests/test_tag.py +++ b/tests/test_tag.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastTag(PyLastTestCase): +class TestPyLastTag(TestPyLastWithLastFm): def test_tag_is_hashable(self): # Arrange diff --git a/tests/test_track.py b/tests/test_track.py index bb34f56..b68c065 100755 --- a/tests/test_track.py +++ b/tests/test_track.py @@ -6,10 +6,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastTrack(PyLastTestCase): +class TestPyLastTrack(TestPyLastWithLastFm): def test_love(self): # Arrange diff --git a/tests/test_user.py b/tests/test_user.py index ecb7c94..7b0e636 100755 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -7,10 +7,10 @@ import unittest import pylast -from .test_pylast import PyLastTestCase +from .test_pylast import TestPyLastWithLastFm -class TestPyLastUser(PyLastTestCase): +class TestPyLastUser(TestPyLastWithLastFm): def test_repr(self): # Arrange