mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
test for star_import cache that wasn't invalidated
This commit is contained in:
@@ -35,6 +35,24 @@ class Base(unittest.TestCase):
|
||||
|
||||
|
||||
class TestRegression(Base):
|
||||
def test_star_import_cache_duration(self):
|
||||
new = 0.01
|
||||
old, api.settings.star_import_cache_validity = \
|
||||
api.settings.star_import_cache_validity, new
|
||||
|
||||
imports = api.imports
|
||||
imports.star_import_cache = {} # first empty...
|
||||
# path needs to be not-None (otherwise caching effects are not visible)
|
||||
api.Script('', 1,0, '').complete()
|
||||
time.sleep(2*new)
|
||||
api.Script('', 1,0, '').complete()
|
||||
|
||||
# reset values
|
||||
api.settings.star_import_cache_validity = old
|
||||
length = len(imports.star_import_cache)
|
||||
imports.star_import_cache = {}
|
||||
self.assertEqual(length, 1)
|
||||
|
||||
def test_part_parser(self):
|
||||
""" test the get_in_function_call speedups """
|
||||
s = '\n' * 100 + 'abs('
|
||||
|
||||
@@ -267,6 +267,7 @@ print('\nSummary: (%s fails)' % tests_fail)
|
||||
for s in summary:
|
||||
print(s)
|
||||
|
||||
import mem_debug
|
||||
|
||||
exit_code = 1 if tests_fail else 0
|
||||
if sys.hexversion < 0x02060000 and tests_fail <= 5:
|
||||
|
||||
Reference in New Issue
Block a user