tests: Ignore deprecated tracklist.add(tracks=...) in local tests
Note, this is mostly because these tests are just core tests in disguise and need a lot more love than I can give them right now.
This commit is contained in:
parent
c85689edad
commit
dc673d554c
@ -1,5 +1,7 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import warnings
|
||||
|
||||
|
||||
def generate_song(i):
|
||||
return 'local:track:song%s.wav' % i
|
||||
@ -7,7 +9,9 @@ def generate_song(i):
|
||||
|
||||
def populate_tracklist(func):
|
||||
def wrapper(self):
|
||||
self.tl_tracks = self.core.tracklist.add(self.tracks)
|
||||
with warnings.catch_warnings():
|
||||
warnings.filterwarnings('ignore', 'tracklist.add.*"tracks".*')
|
||||
self.tl_tracks = self.core.tracklist.add(self.tracks)
|
||||
return func(self)
|
||||
|
||||
wrapper.__name__ = func.__name__
|
||||
|
||||
@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import time
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
import mock
|
||||
|
||||
@ -55,8 +56,13 @@ class LocalPlaybackProviderTest(unittest.TestCase):
|
||||
assert self.tracks[0].length >= 2000, \
|
||||
'First song needs to be at least 2000 miliseconds'
|
||||
|
||||
self._warnings_filters = warnings.filters
|
||||
warnings.filters = warnings.filters[:]
|
||||
warnings.filterwarnings('ignore', 'tracklist.add.*"tracks".*')
|
||||
|
||||
def tearDown(self): # noqa: N802
|
||||
pykka.ActorRegistry.stop_all()
|
||||
warnings.filters = self._warnings_filters
|
||||
|
||||
def test_uri_scheme(self):
|
||||
self.assertNotIn('file', self.core.uri_schemes)
|
||||
|
||||
@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
import random
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
import pykka
|
||||
|
||||
@ -36,8 +37,13 @@ class LocalTracklistProviderTest(unittest.TestCase):
|
||||
|
||||
assert len(self.tracks) == 3, 'Need three tracks to run tests.'
|
||||
|
||||
self._warnings_filters = warnings.filters
|
||||
warnings.filters = warnings.filters[:]
|
||||
warnings.filterwarnings('ignore', 'tracklist.add.*"tracks".*')
|
||||
|
||||
def tearDown(self): # noqa: N802
|
||||
pykka.ActorRegistry.stop_all()
|
||||
warnings.filters = self._warnings_filters
|
||||
|
||||
def test_length(self):
|
||||
self.assertEqual(0, len(self.controller.tl_tracks))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user