From b357c099bc985591c57e59b9e3aa5e30f488be77 Mon Sep 17 00:00:00 2001 From: David Halter Date: Mon, 7 Oct 2013 21:43:23 +0430 Subject: [PATCH] test for imports that are not in the sys.path. --- test/not_in_sys_path/not_in_sys_path.py | 1 + test/not_in_sys_path/pkg/module.py | 3 +++ test/test_imports.py | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 test/not_in_sys_path/not_in_sys_path.py create mode 100644 test/not_in_sys_path/pkg/module.py diff --git a/test/not_in_sys_path/not_in_sys_path.py b/test/not_in_sys_path/not_in_sys_path.py new file mode 100644 index 00000000..8943d8df --- /dev/null +++ b/test/not_in_sys_path/not_in_sys_path.py @@ -0,0 +1 @@ +value = 3 diff --git a/test/not_in_sys_path/pkg/module.py b/test/not_in_sys_path/pkg/module.py new file mode 100644 index 00000000..0be2f1f8 --- /dev/null +++ b/test/not_in_sys_path/pkg/module.py @@ -0,0 +1,3 @@ +import not_in_sys_path + +not_in_sys_path.value diff --git a/test/test_imports.py b/test/test_imports.py index f2f1798b..5c4105d8 100644 --- a/test/test_imports.py +++ b/test/test_imports.py @@ -1,8 +1,8 @@ -import sys - import pytest +import jedi from jedi._compatibility import find_module_py33 +from .helpers import cwd_at @pytest.mark.skipif('sys.version_info < (3,3)') @@ -10,3 +10,13 @@ def test_find_module_py33(): """Needs to work like the old find_module.""" print(find_module_py33('_io')) assert find_module_py33('_io') == (None, '_io', False) + + +@cwd_at('test/not_in_sys_path/pkg') +def test_import_not_in_sys_path(): + """ + non-direct imports (not in sys.path) + """ + jedi.set_debug_function() + a = jedi.Script(path='module.py', line=3).goto_definitions() + assert a[0].name == 'int'