1
0
forked from VimPlug/jedi

move cache test to the right file, #181

This commit is contained in:
David Halter
2013-08-07 17:22:21 +04:30
parent 0b3a623c8d
commit 686e29c2f2
2 changed files with 22 additions and 20 deletions

View File

@@ -1,6 +1,9 @@
import time
import pytest
from jedi import settings
import jedi
from jedi import settings, cache
from jedi.cache import ParserCacheItem, _ModulePickling
@@ -52,3 +55,21 @@ def test_modulepickling_delete_incompatible_cache():
cache2.version = 2
cached2 = load_stored_item(cache2, path, item)
assert cached2 is None
def test_star_import_cache_duration():
new = 0.01
old, jedi.settings.star_import_cache_validity = \
jedi.settings.star_import_cache_validity, new
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)
jedi.Script('', 1, 0, '').completions()
# reset values
jedi.settings.star_import_cache_validity = old
length = len(cache.star_import_cache)
cache.star_import_cache = {}
assert length == 1