From f302949ea96fd73a33417a01686a5301db06b014 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Wed, 12 Dec 2012 13:43:41 +0100 Subject: [PATCH] tests: Use empty tag cache in all local backend tests --- tests/backends/local/events_test.py | 11 ++++++++++- tests/backends/local/playback_test.py | 1 + tests/backends/local/playlists_test.py | 8 ++++++++ tests/backends/local/tracklist_test.py | 3 ++- tests/backends/local/translator_test.py | 2 +- 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tests/backends/local/events_test.py b/tests/backends/local/events_test.py index ba61f97a..79d2780b 100644 --- a/tests/backends/local/events_test.py +++ b/tests/backends/local/events_test.py @@ -1,8 +1,17 @@ +from mopidy import settings from mopidy.backends.local import LocalBackend -from tests import unittest +from tests import unittest, path_to_data_dir from tests.backends.base import events class LocalBackendEventsTest(events.BackendEventsTest, unittest.TestCase): backend_class = LocalBackend + + def setUp(self): + settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache') + super(LocalBackendEventsTest, self).setUp() + + def tearDown(self): + super(LocalBackendEventsTest, self).tearDown() + settings.runtime.clear() diff --git a/tests/backends/local/playback_test.py b/tests/backends/local/playback_test.py index 9731f70d..9a306ee0 100644 --- a/tests/backends/local/playback_test.py +++ b/tests/backends/local/playback_test.py @@ -18,6 +18,7 @@ class LocalPlaybackControllerTest(PlaybackControllerTest, unittest.TestCase): def setUp(self): settings.BACKENDS = ('mopidy.backends.local.LocalBackend',) + settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache') super(LocalPlaybackControllerTest, self).setUp() def tearDown(self): diff --git a/tests/backends/local/playlists_test.py b/tests/backends/local/playlists_test.py index fcc39132..70ed27d6 100644 --- a/tests/backends/local/playlists_test.py +++ b/tests/backends/local/playlists_test.py @@ -18,6 +18,14 @@ class LocalPlaylistsControllerTest( backend_class = LocalBackend + def setUp(self): + settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache') + super(LocalPlaylistsControllerTest, self).setUp() + + def tearDown(self): + super(LocalPlaylistsControllerTest, self).tearDown() + settings.runtime.clear() + def test_created_playlist_is_persisted(self): path = os.path.join(settings.LOCAL_PLAYLIST_PATH, 'test.m3u') self.assertFalse(os.path.exists(path)) diff --git a/tests/backends/local/tracklist_test.py b/tests/backends/local/tracklist_test.py index f5330f52..735043d6 100644 --- a/tests/backends/local/tracklist_test.py +++ b/tests/backends/local/tracklist_test.py @@ -4,7 +4,7 @@ from mopidy import settings from mopidy.backends.local import LocalBackend from mopidy.models import Track -from tests import unittest +from tests import unittest, path_to_data_dir from tests.backends.base.tracklist import TracklistControllerTest from tests.backends.local import generate_song @@ -16,6 +16,7 @@ class LocalTracklistControllerTest(TracklistControllerTest, unittest.TestCase): def setUp(self): settings.BACKENDS = ('mopidy.backends.local.LocalBackend',) + settings.LOCAL_TAG_CACHE_FILE = path_to_data_dir('empty_tag_cache') super(LocalTracklistControllerTest, self).setUp() def tearDown(self): diff --git a/tests/backends/local/translator_test.py b/tests/backends/local/translator_test.py index e18b13fe..90ee849d 100644 --- a/tests/backends/local/translator_test.py +++ b/tests/backends/local/translator_test.py @@ -5,9 +5,9 @@ from __future__ import unicode_literals import os import tempfile -from mopidy.utils.path import path_to_uri from mopidy.backends.local.translator import parse_m3u, parse_mpd_tag_cache from mopidy.models import Track, Artist, Album +from mopidy.utils.path import path_to_uri from tests import unittest, path_to_data_dir