Skip to content

Commit

Permalink
test_imports: add test to ensure caching works with sys_path
Browse files Browse the repository at this point in the history
  • Loading branch information
immerrr committed Oct 21, 2015
1 parent e3a533c commit cb9ff53
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/test_evaluate/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,19 @@ def test_flask_ext(script, name):
def test_not_importable_file():
src = 'import not_importable_file as x; x.'
assert not jedi.Script(src, path='example.py').completions()


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]

0 comments on commit cb9ff53

Please sign in to comment.