summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchfw <wangc_2011@hotmail.com>2018-08-02 21:30:18 (GMT)
committerchfw <wangc_2011@hotmail.com>2018-08-02 21:30:18 (GMT)
commitf62d5baadf73b4b87b65dc05c7489a9972cbb642 (patch)
tree3b8be53d4499c1de718646b10c9bd9a90b0d7ca0
parente13220d0878c41b79a4f905b12fb63a72804ebe4 (diff)
downloadpython-lml-f62d5baadf73b4b87b65dc05c7489a9972cbb642.zip
python-lml-f62d5baadf73b4b87b65dc05c7489a9972cbb642.tar.gz
python-lml-f62d5baadf73b4b87b65dc05c7489a9972cbb642.tar.bz2
:microscope: more test coverage
-rw-r--r--tests/test_plugin_loader.py12
1 files changed, 11 insertions, 1 deletions
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')
@@ -13,6 +13,16 @@ def test_load_from_pyinstaller(pkgutil_get_importer):
@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,
pkgutil_get_importer):