Debian Codegraph @

debian/tests/smoke.py

raw symbols SCIP
1 import os
2
3 from beaker import cache
4 from beaker.util import parse_cache_config_options
5
6 TMPDIR = os.getenv("AUTOPKGTEST_TMP")
7
8 options = {
9 "cache.type": "file",
10 "cache.data_dir": TMPDIR,
11 "cache.lock_dir": TMPDIR,
12 }
13
14 cache_manager = cache.CacheManager(**parse_cache_config_options(options))
15
16 test_cache = cache_manager.get_cache("test", type="file", expire=5)
17
18 test_cache.set_value(key="there", value=1)
19
20 assert test_cache.get(key="there") == 1
21
22 try:
23 test_cache.get(key="not_there")
24 except KeyError:
25 print("OK!")