From 92b5c70ea017c1bdeec5d287ce98efff46ddf17c Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 9 Dec 2012 22:55:49 +0100 Subject: [PATCH] reduced support for None paths in path search, because the path should be set normally. -> fixes #75 --- jedi/modules.py | 3 +++ test/regression.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jedi/modules.py b/jedi/modules.py index 76dd5f14..2421e913 100644 --- a/jedi/modules.py +++ b/jedi/modules.py @@ -275,6 +275,9 @@ def sys_path_with_modifications(module): debug.dbg('sys path added: %s' % res) return sys_path + if module.path is None: + return [] # support for modules without a path is intentionally bad. + curdir = os.path.abspath(os.curdir) try: os.chdir(os.path.dirname(module.path)) diff --git a/test/regression.py b/test/regression.py index 73cec405..17910ccd 100755 --- a/test/regression.py +++ b/test/regression.py @@ -271,11 +271,15 @@ class TestRegression(Base): assert [d.doc for d in defs] def test_goto_following_on_imports(self): - g = self.goto("import multiprocessing.dummy; multiprocessing.dummy") - assert len(g) == 1 if not is_py25: + g = self.goto("import multiprocessing.dummy; multiprocessing.dummy") + assert len(g) == 1 assert g[0].start_pos != (0, 0) + script = api.Script("import json", 1, len("import js"), None) + completions = script.complete() + completions + class TestFeature(Base): def test_full_name(self):