Minimal test for plugins checking pkg_resources
This commit is contained in:
parent
83467ee000
commit
7d4977364d
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)
|
||||
suite.addTests(qt_tests)
|
||||
|
||||
import plugins.tests
|
||||
suite.addTests(loader.loadTestsFromModule(plugins.tests))
|
||||
|
||||
def keep_exc(ex_cls, exc, tb): # pylint: disable=unused-argument
|
||||
"""Own exception hook for test cases"""
|
||||
excQueue.put(('tests', exc))
|
||||
|
|
Reference in New Issue
Block a user