1
0
forked from VimPlug/jedi

Fix a NotImplementedError when loading random modules

This commit is contained in:
Dave Halter
2019-05-20 09:54:41 +02:00
parent 03de39092a
commit 95cd8427f4
2 changed files with 45 additions and 22 deletions

View File

@@ -325,6 +325,22 @@ def test_get_modules_containing_name(evaluator, path, goal, is_package):
assert found_module.string_names == goal
@pytest.mark.parametrize(
('path', 'base_names', 'is_package', 'names'), [
('/foo/bar.py', ('foo',), False, ('foo', 'bar')),
('/foo/bar.py', ('foo', 'baz'), False, ('foo', 'baz', 'bar')),
('/foo/__init__.py', ('foo',), True, ('foo',)),
('/__init__.py', ('foo',), True, ('foo',)),
('/foo/bar/__init__.py', ('foo',), True, ('foo',)),
('/foo/bar/__init__.py', ('foo', 'bar'), True, ('foo', 'bar')),
]
)
def test_load_module_from_path(evaluator, path, base_names, is_package, names):
m = imports._load_module_from_path(evaluator, path, base_names, '')
assert m.is_package == is_package
assert m.string_names == names
@pytest.mark.parametrize(
'path', ('api/whatever/test_this.py', 'api/whatever/file'))
@pytest.mark.parametrize('empty_sys_path', (False, True))