From d640f3bc252d194062d76e319c562d36c3055fc8 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Sat, 20 Feb 2021 22:48:55 +0200 Subject: [PATCH] Minimal test for plugins checking pkg_resources --- src/plugins/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/plugins/tests.py diff --git a/src/plugins/tests.py b/src/plugins/tests.py new file mode 100644 index 00000000..5de96e9a --- /dev/null +++ b/src/plugins/tests.py @@ -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')