Merge branch 'tests-plugin' into testing
This commit is contained in:
commit
f8d9a68d13
|
@ -34,7 +34,7 @@ class TestBase(unittest.TestCase):
|
||||||
self.fail('Exception in the main thread: %s' % exc)
|
self.fail('Exception in the main thread: %s' % exc)
|
||||||
|
|
||||||
|
|
||||||
class TestMain(unittest.TestCase):
|
class TestMain(TestBase):
|
||||||
"""Test case for main window - basic features"""
|
"""Test case for main window - basic features"""
|
||||||
|
|
||||||
def test_translate(self):
|
def test_translate(self):
|
||||||
|
@ -44,6 +44,11 @@ class TestMain(unittest.TestCase):
|
||||||
QtCore.QString
|
QtCore.QString
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@unittest.skipIf(bitmessageqt.get_plugins, 'skip plugin absence test')
|
||||||
|
def test_sound(self):
|
||||||
|
"""Check if playing sound raises an exception if there is no plugin"""
|
||||||
|
self.window.playSound(bitmessageqt.sound.SOUND_CONNECTED, None)
|
||||||
|
|
||||||
|
|
||||||
class TestUISignaler(TestBase):
|
class TestUISignaler(TestBase):
|
||||||
"""Test case for UISignalQueue"""
|
"""Test case for UISignalQueue"""
|
||||||
|
|
16
src/plugins/tests.py
Normal file
16
src/plugins/tests.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import unittest
|
||||||
|
from importlib import import_module
|
||||||
|
|
||||||
|
try:
|
||||||
|
import pkg_resources
|
||||||
|
except ImportError:
|
||||||
|
pkg_resources = None
|
||||||
|
|
||||||
|
|
||||||
|
class TestPlugins(unittest.TestCase):
|
||||||
|
"""Test case for plugins package"""
|
||||||
|
def test_get_plugin(self):
|
||||||
|
"""Import from plugin raises ImportError without pkg_resources"""
|
||||||
|
if pkg_resources is None:
|
||||||
|
with self.assertRaises(ImportError):
|
||||||
|
import_module('plugin')
|
|
@ -424,6 +424,9 @@ def run():
|
||||||
qt_tests = loader.loadTestsFromModule(bitmessageqt.tests)
|
qt_tests = loader.loadTestsFromModule(bitmessageqt.tests)
|
||||||
suite.addTests(qt_tests)
|
suite.addTests(qt_tests)
|
||||||
|
|
||||||
|
import plugins.tests
|
||||||
|
suite.addTests(loader.loadTestsFromModule(plugins.tests))
|
||||||
|
|
||||||
def keep_exc(ex_cls, exc, tb): # pylint: disable=unused-argument
|
def keep_exc(ex_cls, exc, tb): # pylint: disable=unused-argument
|
||||||
"""Own exception hook for test cases"""
|
"""Own exception hook for test cases"""
|
||||||
excQueue.put(('tests', exc))
|
excQueue.put(('tests', exc))
|
||||||
|
|
Reference in New Issue
Block a user