test for star_import cache that wasn't invalidated

This commit is contained in:
David Halter
2012-12-09 14:40:24 +01:00
parent 60ed17ec53
commit 151bd3c5a1
2 changed files with 19 additions and 0 deletions

View File

@@ -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('

View File

@@ -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: