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,