Fix remaining tests

This commit is contained in:
Dave Halter
2020-01-22 00:36:30 +01:00
parent 6df755e8b6
commit 9d7858eb3a
3 changed files with 12 additions and 5 deletions

View File

@@ -266,8 +266,8 @@ def get_module_contexts_containing_name(inference_state, module_contexts, name,
if m is not None: if m is not None:
parsed_file_count += 1 parsed_file_count += 1
yield m yield m
if parsed_file_count > parse_limit: if parsed_file_count >= parse_limit:
break break
if file_io_count > open_limit: if file_io_count >= open_limit:
break break

View File

@@ -5,7 +5,9 @@ def test_import_references(Script):
def test_exclude_builtin_modules(Script): def test_exclude_builtin_modules(Script):
def get(include): def get(include):
references = Script(source).find_references(column=8, include_builtins=include) from jedi.api.project import Project
script = Script(source, _project=Project('', sys_path=[]))
references = script.find_references(column=8, include_builtins=include)
return [(d.line, d.column) for d in references] return [(d.line, d.column) for d in references]
source = '''import sys\nprint(sys.path)''' source = '''import sys\nprint(sys.path)'''
places = get(include=True) places = get(include=True)

View File

@@ -307,8 +307,13 @@ def test_compiled_import_none(monkeypatch, Script):
@pytest.mark.parametrize( @pytest.mark.parametrize(
('path', 'is_package', 'goal'), [ ('path', 'is_package', 'goal'), [
(os.path.join(THIS_DIR, 'test_docstring.py'), False, ('ok', 'lala', 'test_imports')), # Both of these tests used to return relative paths to the module
(os.path.join(THIS_DIR, '__init__.py'), True, ('ok', 'lala', 'x', 'test_imports')), # context that was initially given, but now we just work with the file
# system.
(os.path.join(THIS_DIR, 'test_docstring.py'), False,
('test', 'test_inference', 'test_imports')),
(os.path.join(THIS_DIR, '__init__.py'), True,
('test', 'test_inference', 'test_imports')),
] ]
) )
def test_get_modules_containing_name(inference_state, path, goal, is_package): def test_get_modules_containing_name(inference_state, path, goal, is_package):