From f62d5baadf73b4b87b65dc05c7489a9972cbb642 Mon Sep 17 00:00:00 2001 From: chfw Date: Thu, 2 Aug 2018 22:30:18 +0100 Subject: [PATCH] :microscope: more test coverage --- tests/test_plugin_loader.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_plugin_loader.py b/tests/test_plugin_loader.py index 744ef83..3005697 100644 --- a/tests/test_plugin_loader.py +++ b/tests/test_plugin_loader.py @@ -4,7 +4,7 @@ from nose.tools import eq_ @patch('pkgutil.get_importer') def test_load_from_pyinstaller(pkgutil_get_importer): - sample_toc = set(['pyexcel_io', 'pyexcel_xls', 'blah']) + sample_toc = set(['pyexcel_io', 'pyexcel_xls', 'blah', 'test.dot.module']) pkgutil_get_importer.return_value.toc = sample_toc from lml.loader import scan_from_pyinstaller module_names = scan_from_pyinstaller('pyexcel_', 'path') @@ -12,6 +12,16 @@ def test_load_from_pyinstaller(pkgutil_get_importer): eq_(sorted(list(module_names)), sorted(expected)) +@patch('pkgutil.get_importer') +def test_load_from_pyinstaller_with_regex(pkgutil_get_importer): + sample_toc = set(['pyexcel_io', 'pyexcel_xls', 'blah']) + pkgutil_get_importer.return_value.toc = sample_toc + from lml.loader import scan_from_pyinstaller + module_names = scan_from_pyinstaller('^.+cel_.+$', 'path') + expected = ['pyexcel_io', 'pyexcel_xls'] + eq_(sorted(list(module_names)), sorted(expected)) + + @patch('pkgutil.get_importer') @patch('pkgutil.iter_modules') def test_load_plugins(pkgutil_iter_modules,