|
|
@ -11,6 +11,8 @@ from patacrep.tools.__main__ import main as tools_main |
|
|
|
from patacrep.tools.cache.__main__ import main as cache_main |
|
|
|
from patacrep.songbook.__main__ import main as songbook_main |
|
|
|
|
|
|
|
from .. import logging_reduced |
|
|
|
|
|
|
|
CACHEDIR = os.path.join(os.path.dirname(__file__), "test_cache_datadir", ".cache") |
|
|
|
|
|
|
|
class TestCache(unittest.TestCase): |
|
|
@ -46,11 +48,16 @@ class TestCache(unittest.TestCase): |
|
|
|
]: |
|
|
|
with self.subTest(main=main, args=args): |
|
|
|
# First compilation. Ensure that cache exists afterwards |
|
|
|
self._system(songbook_main, ["songbook", "--steps", "tex,clean", "test_cache.yaml"]) |
|
|
|
with logging_reduced('patacrep.build'): |
|
|
|
self._system( |
|
|
|
songbook_main, |
|
|
|
["songbook", "--steps", "tex,clean", "test_cache.yaml"] |
|
|
|
) |
|
|
|
self.assertTrue(os.path.exists(CACHEDIR)) |
|
|
|
|
|
|
|
# Clean cache |
|
|
|
self._system(main, args) |
|
|
|
with logging_reduced('patatools.cache'): |
|
|
|
self._system(main, args) |
|
|
|
|
|
|
|
# Ensure that cache does not exist |
|
|
|
self.assertFalse(os.path.exists(CACHEDIR)) |
|
|
@ -64,4 +71,5 @@ class TestCache(unittest.TestCase): |
|
|
|
]: |
|
|
|
with self.subTest(main=main, args=args): |
|
|
|
# Clean cache |
|
|
|
self._system(main, args) |
|
|
|
with logging_reduced('patatools.cache'): |
|
|
|
self._system(main, args) |
|
|
|