forked from VimPlug/jedi
Make it clear in search tests if a stub or a normal definition is expected
This commit is contained in:
@@ -38,6 +38,10 @@ class _ModuleAttributeName(AbstractNameDefinition):
|
|||||||
return compiled.get_string_value_set(self.parent_context.inference_state)
|
return compiled.get_string_value_set(self.parent_context.inference_state)
|
||||||
|
|
||||||
|
|
||||||
|
def iter_module_names(*args, **kwargs):
|
||||||
|
return sorted(set(iter_module_names(*args, **kwargs)))
|
||||||
|
|
||||||
|
|
||||||
def iter_module_names(inference_state, paths):
|
def iter_module_names(inference_state, paths):
|
||||||
# Python modules/packages
|
# Python modules/packages
|
||||||
for path in paths:
|
for path in paths:
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ def test_load_save_project(tmpdir):
|
|||||||
|
|
||||||
('sample_int', ['helpers.sample_int'], {}),
|
('sample_int', ['helpers.sample_int'], {}),
|
||||||
('sample_int', ['helpers.sample_int'], dict(all_scopes=True)),
|
('sample_int', ['helpers.sample_int'], dict(all_scopes=True)),
|
||||||
('sample_int.real', ['builtins.int.real'], {}),
|
('sample_int.real', ['stub:builtins.int.real'], {}),
|
||||||
|
|
||||||
('class sample_int.real', [], {}),
|
('class sample_int.real', [], {}),
|
||||||
('foo sample_int.real', [], {}),
|
('foo sample_int.real', [], {}),
|
||||||
('def sample_int.real', ['builtins.int.real'], {}),
|
('def sample_int.real', ['stub:builtins.int.real'], {}),
|
||||||
('function sample_int.real', ['builtins.int.real'], {}),
|
('function sample_int.real', ['stub:builtins.int.real'], {}),
|
||||||
|
|
||||||
# With modules
|
# With modules
|
||||||
('test_project.test_search', ['test_api.test_project.test_search'], {}),
|
('test_project.test_search', ['test_api.test_project.test_search'], {}),
|
||||||
@@ -90,8 +90,9 @@ def test_load_save_project(tmpdir):
|
|||||||
dict(complete=True)),
|
dict(complete=True)),
|
||||||
|
|
||||||
# On sys path
|
# On sys path
|
||||||
('sys.path', ['sys.path'], {}),
|
('sys.path', ['stub:sys.path'], {}),
|
||||||
('json.dumps', ['json.dumps', 'json.dumps'], {}), # stdlib + stub
|
('json.dumps', ['stub:json.dumps', 'json.dumps'], {}), # stdlib + stub
|
||||||
|
('multiprocessing', ['stub:multiprocessing'], {})
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
|
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Ignore Python 2, because EOL")
|
||||||
@@ -99,4 +100,4 @@ def test_search(string, full_names, kwargs, skip_pre_python36):
|
|||||||
some_search_test_var = 1.0
|
some_search_test_var = 1.0
|
||||||
project = Project(test_dir)
|
project = Project(test_dir)
|
||||||
defs = project.search(string, **kwargs)
|
defs = project.search(string, **kwargs)
|
||||||
assert [d.full_name for d in defs] == full_names
|
assert [('stub:' if d.is_stub() else '') + d.full_name for d in defs] == full_names
|
||||||
|
|||||||
Reference in New Issue
Block a user