forked from VimPlug/jedi
fix last remaining issues with tests
This commit is contained in:
@@ -408,7 +408,7 @@ class Completion(BaseDefinition):
|
|||||||
return [self]
|
return [self]
|
||||||
|
|
||||||
self._followed_definitions = \
|
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()
|
clear_caches()
|
||||||
|
|
||||||
return self._followed_definitions
|
return self._followed_definitions
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def test_star_import_cache_duration():
|
|||||||
old, jedi.settings.star_import_cache_validity = \
|
old, jedi.settings.star_import_cache_validity = \
|
||||||
jedi.settings.star_import_cache_validity, new
|
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)
|
# path needs to be not-None (otherwise caching effects are not visible)
|
||||||
jedi.Script('', 1, 0, '').completions()
|
jedi.Script('', 1, 0, '').completions()
|
||||||
time.sleep(2 * new)
|
time.sleep(2 * new)
|
||||||
@@ -74,6 +74,6 @@ def test_star_import_cache_duration():
|
|||||||
|
|
||||||
# reset values
|
# reset values
|
||||||
jedi.settings.star_import_cache_validity = old
|
jedi.settings.star_import_cache_validity = old
|
||||||
length = len(cache.star_import_cache)
|
length = len(cache._star_import_cache)
|
||||||
cache.star_import_cache = {}
|
cache._star_import_cache = {}
|
||||||
assert length == 1
|
assert length == 1
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import textwrap
|
|||||||
|
|
||||||
import jedi
|
import jedi
|
||||||
from jedi import api_classes
|
from jedi import api_classes
|
||||||
|
from jedi.evaluate import Evaluator
|
||||||
from .helpers import TestCase
|
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
|
# Using `from jedi.keywords import Keyword` here does NOT work
|
||||||
# in Python 3. This is due to the import hack jedi using.
|
# in Python 3. This is due to the import hack jedi using.
|
||||||
Keyword = api_classes.keywords.Keyword
|
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
|
assert d.full_name is None
|
||||||
|
|||||||
@@ -75,13 +75,14 @@ class TestRegression(TestCase):
|
|||||||
|
|
||||||
@cwd_at('jedi')
|
@cwd_at('jedi')
|
||||||
def test_add_dynamic_mods(self):
|
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.
|
# 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.
|
# 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
|
# .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()
|
result = Script(src1, path='../setup.py').goto_definitions()
|
||||||
assert len(result) == 1
|
assert len(result) == 1
|
||||||
assert result[0].description == 'class int'
|
assert result[0].description == 'class int'
|
||||||
|
|||||||
Reference in New Issue
Block a user