forked from VimPlug/jedi
Change two tests that were written in a strange way
This commit is contained in:
@@ -37,27 +37,33 @@ def test_find_module_not_package():
|
|||||||
|
|
||||||
|
|
||||||
def test_find_module_package_zipped():
|
def test_find_module_package_zipped():
|
||||||
if 'zipped_imports/pkg.zip' not in sys.path:
|
path = os.path.join(os.path.dirname(__file__), 'zipped_imports/pkg.zip')
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
sys.path.append(path)
|
||||||
'zipped_imports/pkg.zip'))
|
try:
|
||||||
file, path, is_package = find_module('pkg')
|
file, path, is_package = find_module('pkg')
|
||||||
assert file is not None
|
assert file is not None
|
||||||
assert path.endswith('pkg.zip')
|
assert path.endswith('pkg.zip')
|
||||||
assert is_package is True
|
assert is_package is True
|
||||||
assert len(jedi.Script('import pkg; pkg.mod', 1, 19).completions()) == 1
|
finally:
|
||||||
|
sys.path.pop()
|
||||||
|
|
||||||
|
script = jedi.Script('import pkg; pkg.mod', 1, 19, sys_path=[path])
|
||||||
|
assert len(script.completions()) == 1
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif('sys.version_info < (2,7)')
|
@pytest.mark.skipif('sys.version_info < (2,7)')
|
||||||
def test_find_module_not_package_zipped():
|
def test_find_module_not_package_zipped():
|
||||||
if 'zipped_imports/not_pkg.zip' not in sys.path:
|
path = os.path.join(os.path.dirname(__file__), 'zipped_imports/not_pkg.zip')
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__),
|
sys.path.append(path)
|
||||||
'zipped_imports/not_pkg.zip'))
|
try:
|
||||||
file, path, is_package = find_module('not_pkg')
|
file, path, is_package = find_module('not_pkg')
|
||||||
assert file is not None
|
assert file is not None
|
||||||
assert path.endswith('not_pkg.zip')
|
assert path.endswith('not_pkg.zip')
|
||||||
assert is_package is False
|
assert is_package is False
|
||||||
assert len(
|
finally:
|
||||||
jedi.Script('import not_pkg; not_pkg.val', 1, 27).completions()) == 1
|
sys.path.pop()
|
||||||
|
script = jedi.Script('import not_pkg; not_pkg.val', 1, 27, sys_path=[path])
|
||||||
|
assert len(script.completions()) == 1
|
||||||
|
|
||||||
|
|
||||||
@cwd_at('test/test_evaluate/not_in_sys_path/pkg')
|
@cwd_at('test/test_evaluate/not_in_sys_path/pkg')
|
||||||
|
|||||||
Reference in New Issue
Block a user