mirror of
https://github.com/beetbox/beets.git
synced 2025-12-08 01:23:09 +01:00
Convert SKIP_SLOW_TESTS to its own decorator
This commit is contained in:
parent
0e0691bf77
commit
d93f723263
8 changed files with 22 additions and 24 deletions
|
|
@ -346,3 +346,11 @@ def system_mock(name):
|
|||
yield
|
||||
finally:
|
||||
platform.system = old_system
|
||||
|
||||
|
||||
def slowTest(unused=None):
|
||||
def _id(obj):
|
||||
return obj
|
||||
if 'SKIP_SLOW_TESTS' in os.environ:
|
||||
return unittest.skip('test is slow')
|
||||
return _id
|
||||
|
|
|
|||
|
|
@ -261,8 +261,7 @@ class GoogleImageTest(UseThePlugin):
|
|||
self.assertEqual(list(result_url), [])
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class ArtImporterTest(UseThePlugin):
|
||||
def setUp(self):
|
||||
super(ArtImporterTest, self).setUp()
|
||||
|
|
|
|||
|
|
@ -64,8 +64,7 @@ class TestHelper(helper.TestHelper):
|
|||
.format(path, tag))
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class ImportConvertTest(unittest.TestCase, TestHelper):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -101,8 +100,7 @@ class ImportConvertTest(unittest.TestCase, TestHelper):
|
|||
self.assertTrue(os.path.isfile(item.path))
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class ConvertCliTest(unittest.TestCase, TestHelper):
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -190,8 +188,7 @@ class ConvertCliTest(unittest.TestCase, TestHelper):
|
|||
self.assertFalse(os.path.exists(converted))
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class NeverConvertLossyFilesTest(unittest.TestCase, TestHelper):
|
||||
"""Test the effect of the `never_convert_lossy_files` option.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import os
|
|||
import shutil
|
||||
import sqlite3
|
||||
|
||||
from test import _common
|
||||
from test._common import unittest
|
||||
from beets import dbcore
|
||||
from tempfile import mkstemp
|
||||
|
|
@ -127,8 +128,7 @@ class TestModelWithGetters(dbcore.Model):
|
|||
return {}
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class MigrationTest(unittest.TestCase):
|
||||
"""Tests the ability to change the database schema between
|
||||
versions.
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@
|
|||
from __future__ import (division, absolute_import, print_function,
|
||||
unicode_literals)
|
||||
import codecs
|
||||
import os
|
||||
|
||||
from mock import patch
|
||||
from test import _common
|
||||
from test._common import unittest
|
||||
from test.helper import TestHelper, control_stdin
|
||||
|
||||
|
|
@ -63,8 +63,7 @@ class ModifyFileMocker(object):
|
|||
f.write(contents)
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class EditCommandTest(unittest.TestCase, TestHelper):
|
||||
""" Black box tests for `beetsplug.edit`. Command line interaction is
|
||||
simulated using `test.helper.control_stdin()`, and yaml editing via an
|
||||
|
|
|
|||
|
|
@ -236,8 +236,7 @@ class ImportHelper(TestHelper):
|
|||
self.assertEqual(len(os.listdir(self.libdir)), 0)
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class NonAutotaggedImportTest(_common.TestCase, ImportHelper):
|
||||
def setUp(self):
|
||||
self.setup_beets(disk=True)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ from __future__ import (division, absolute_import, print_function,
|
|||
unicode_literals)
|
||||
|
||||
import sys
|
||||
import os
|
||||
import threading
|
||||
import logging as log
|
||||
from StringIO import StringIO
|
||||
|
|
@ -13,6 +12,7 @@ from StringIO import StringIO
|
|||
import beets.logging as blog
|
||||
from beets import plugins, ui
|
||||
import beetsplug
|
||||
from test import _common
|
||||
from test._common import unittest, TestCase
|
||||
from test import helper
|
||||
|
||||
|
|
@ -164,8 +164,7 @@ class LoggingLevelTest(unittest.TestCase, helper.TestHelper):
|
|||
self.assertIn('dummy: debug import_stage', logs)
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class ConcurrentEventsTest(TestCase, helper.TestHelper):
|
||||
"""Similar to LoggingLevelTest but lower-level and focused on multiple
|
||||
events interaction. Since this is a bit heavy we don't do it in
|
||||
|
|
|
|||
|
|
@ -594,8 +594,7 @@ class InputTest(_common.TestCase):
|
|||
self.assertEqual(album, u'\xc2me')
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class ConfigTest(unittest.TestCase, TestHelper):
|
||||
def setUp(self):
|
||||
self.setup_beets()
|
||||
|
|
@ -1037,8 +1036,7 @@ class PathFormatTest(_common.TestCase):
|
|||
self.assertEqual(pf[1:], default_formats)
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class PluginTest(_common.TestCase):
|
||||
def test_plugin_command_from_pluginpath(self):
|
||||
config['pluginpath'] = [os.path.join(_common.RSRC, 'beetsplug')]
|
||||
|
|
@ -1046,8 +1044,7 @@ class PluginTest(_common.TestCase):
|
|||
ui._raw_main(['test'])
|
||||
|
||||
|
||||
@unittest.skipIf('SKIP_SLOW_TESTS' in os.environ,
|
||||
'Skipping because test is slow')
|
||||
@_common.slowTest()
|
||||
class CompletionTest(_common.TestCase):
|
||||
def test_completion(self):
|
||||
# Load plugin commands
|
||||
|
|
|
|||
Loading…
Reference in a new issue