mirror of
https://github.com/beetbox/beets.git
synced 2026-01-03 22:42:44 +01:00
Merge pull request #1809 from beetbox/slow_test_decorator
Convert SKIP_SLOW_TESTS to its own decorator
This commit is contained in:
commit
49feaf2a60
9 changed files with 24 additions and 26 deletions
|
|
@ -86,8 +86,8 @@ class PathQuery(dbcore.FieldQuery):
|
|||
colon = query_part.find(':')
|
||||
if colon != -1:
|
||||
query_part = query_part[:colon]
|
||||
return (os.sep in query_part
|
||||
and os.path.exists(syspath(normpath(query_part))))
|
||||
return (os.sep in query_part and
|
||||
os.path.exists(syspath(normpath(query_part))))
|
||||
|
||||
def match(self, item):
|
||||
path = item.path if self.case_sensitive else item.path.lower()
|
||||
|
|
|
|||
|
|
@ -346,3 +346,11 @@ def system_mock(name):
|
|||
yield
|
||||
finally:
|
||||
platform.system = old_system
|
||||
|
||||
|
||||
def slow_test(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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
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.slow_test()
|
||||
class CompletionTest(_common.TestCase):
|
||||
def test_completion(self):
|
||||
# Load plugin commands
|
||||
|
|
|
|||
Loading…
Reference in a new issue