🔬 more test coverage

This commit is contained in:
chfw 2018-08-02 22:30:18 +01:00
parent e13220d087
commit f62d5baadf
1 changed files with 11 additions and 1 deletions

View File

@ -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,