From 9d7858eb3a763de11bbcc54a55a0fdfc6d04a241 Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 22 Jan 2020 00:36:30 +0100 Subject: [PATCH] Fix remaining tests --- jedi/inference/references.py | 4 ++-- test/test_api/test_usages.py | 4 +++- test/test_inference/test_imports.py | 9 +++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/jedi/inference/references.py b/jedi/inference/references.py index e78689ff..f8ca496f 100644 --- a/jedi/inference/references.py +++ b/jedi/inference/references.py @@ -266,8 +266,8 @@ def get_module_contexts_containing_name(inference_state, module_contexts, name, if m is not None: parsed_file_count += 1 yield m - if parsed_file_count > parse_limit: + if parsed_file_count >= parse_limit: break - if file_io_count > open_limit: + if file_io_count >= open_limit: break diff --git a/test/test_api/test_usages.py b/test/test_api/test_usages.py index 30a6581a..ec3d47bd 100644 --- a/test/test_api/test_usages.py +++ b/test/test_api/test_usages.py @@ -5,7 +5,9 @@ def test_import_references(Script): def test_exclude_builtin_modules(Script): 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] source = '''import sys\nprint(sys.path)''' places = get(include=True) diff --git a/test/test_inference/test_imports.py b/test/test_inference/test_imports.py index e9edaf8e..9ec393ed 100644 --- a/test/test_inference/test_imports.py +++ b/test/test_inference/test_imports.py @@ -307,8 +307,13 @@ def test_compiled_import_none(monkeypatch, Script): @pytest.mark.parametrize( ('path', 'is_package', 'goal'), [ - (os.path.join(THIS_DIR, 'test_docstring.py'), False, ('ok', 'lala', 'test_imports')), - (os.path.join(THIS_DIR, '__init__.py'), True, ('ok', 'lala', 'x', 'test_imports')), + # Both of these tests used to return relative paths to the module + # 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):