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