forked from VimPlug/jedi
Merge dev into linter.
This commit is contained in:
@@ -46,11 +46,8 @@ def test_flask_ext(script, name):
|
||||
"""flask.ext.foo is really imported from flaskext.foo or flask_foo.
|
||||
"""
|
||||
path = os.path.join(os.path.dirname(__file__), 'flask-site-packages')
|
||||
sys.path.append(path)
|
||||
try:
|
||||
assert name in [c.name for c in jedi.Script(script).completions()]
|
||||
finally:
|
||||
sys.path.remove(path)
|
||||
completions = jedi.Script(script, sys_path=[path]).completions()
|
||||
assert name in [c.name for c in completions]
|
||||
|
||||
|
||||
@cwd_at('test/test_evaluate/')
|
||||
@@ -64,3 +61,19 @@ def test_import_unique():
|
||||
defs = jedi.Script(src, path='example.py').goto_definitions()
|
||||
defs = [d._definition for d in defs]
|
||||
assert len(defs) == len(set(defs))
|
||||
|
||||
|
||||
def test_cache_works_with_sys_path_param(tmpdir):
|
||||
foo_path = tmpdir.join('foo')
|
||||
bar_path = tmpdir.join('bar')
|
||||
foo_path.join('module.py').write('foo = 123', ensure=True)
|
||||
bar_path.join('module.py').write('bar = 123', ensure=True)
|
||||
foo_completions = jedi.Script('import module; module.',
|
||||
sys_path=[foo_path.strpath]).completions()
|
||||
bar_completions = jedi.Script('import module; module.',
|
||||
sys_path=[bar_path.strpath]).completions()
|
||||
assert 'foo' in [c.name for c in foo_completions]
|
||||
assert 'bar' not in [c.name for c in foo_completions]
|
||||
|
||||
assert 'bar' in [c.name for c in bar_completions]
|
||||
assert 'foo' not in [c.name for c in bar_completions]
|
||||
|
||||
Reference in New Issue
Block a user