From 08fba1e191d6e8ca177861d8d36b050577b2042a Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Fri, 27 Dec 2013 02:28:01 +0100 Subject: [PATCH] fix last remaining issues with tests --- jedi/api_classes.py | 2 +- test/test_cache.py | 6 +++--- test/test_full_name.py | 3 ++- test/test_regression.py | 9 +++++---- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/jedi/api_classes.py b/jedi/api_classes.py index c87225d9..49c41320 100644 --- a/jedi/api_classes.py +++ b/jedi/api_classes.py @@ -408,7 +408,7 @@ class Completion(BaseDefinition): return [self] self._followed_definitions = \ - [BaseDefinition(d, d.start_pos) for d in defs] + [BaseDefinition(self._evaluator, d, d.start_pos) for d in defs] clear_caches() return self._followed_definitions diff --git a/test/test_cache.py b/test/test_cache.py index 463fb8a1..aa8a3725 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -66,7 +66,7 @@ def test_star_import_cache_duration(): old, jedi.settings.star_import_cache_validity = \ jedi.settings.star_import_cache_validity, new - cache.star_import_cache = {} # first empty... + cache._star_import_cache = {} # first empty... # path needs to be not-None (otherwise caching effects are not visible) jedi.Script('', 1, 0, '').completions() time.sleep(2 * new) @@ -74,6 +74,6 @@ def test_star_import_cache_duration(): # reset values jedi.settings.star_import_cache_validity = old - length = len(cache.star_import_cache) - cache.star_import_cache = {} + length = len(cache._star_import_cache) + cache._star_import_cache = {} assert length == 1 diff --git a/test/test_full_name.py b/test/test_full_name.py index 5378a97a..a8c83637 100644 --- a/test/test_full_name.py +++ b/test/test_full_name.py @@ -17,6 +17,7 @@ import textwrap import jedi from jedi import api_classes +from jedi.evaluate import Evaluator from .helpers import TestCase @@ -82,5 +83,5 @@ def test_keyword_full_name_should_be_none(): # Using `from jedi.keywords import Keyword` here does NOT work # in Python 3. This is due to the import hack jedi using. Keyword = api_classes.keywords.Keyword - d = api_classes.Definition(Keyword('(', (0, 0))) + d = api_classes.Definition(Evaluator(), Keyword('(', (0, 0))) assert d.full_name is None diff --git a/test/test_regression.py b/test/test_regression.py index c50998c8..035ca3d8 100644 --- a/test/test_regression.py +++ b/test/test_regression.py @@ -75,13 +75,14 @@ class TestRegression(TestCase): @cwd_at('jedi') def test_add_dynamic_mods(self): - api.settings.additional_dynamic_modules = ['dynamic.py'] + fname = '__main__.py' + api.settings.additional_dynamic_modules = [fname] # Fictional module that defines a function. - src1 = "def ret(a): return a" + src1 = "def r(a): return a" # Other fictional modules in another place in the fs. - src2 = 'from .. import setup; setup.ret(1)' + src2 = 'from .. import setup; setup.r(1)' # .parser to load the module - api.modules.Module(os.path.abspath('dynamic.py'), src2).parser + api.modules.Module(os.path.abspath(fname), src2).parser result = Script(src1, path='../setup.py').goto_definitions() assert len(result) == 1 assert result[0].description == 'class int'