From 2771f6c750848f0ac4933a9c774fa4b5d02a7965 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 14 Jul 2019 23:42:23 +0200 Subject: [PATCH] m.math: ensure cache file is reset when cache is not used. Otherwise tests run in batch can sporadically fail. --- plugins/m/math.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/m/math.py b/plugins/m/math.py index 89209ec3..29498ade 100644 --- a/plugins/m/math.py +++ b/plugins/m/math.py @@ -147,10 +147,12 @@ def register_mcss(mcss_settings, hooks_pre_page, hooks_post_run, **kwargs): if settings['M_MATH_CACHE_FILE']: settings['M_MATH_CACHE_FILE'] = os.path.join(settings['INPUT'], settings['M_MATH_CACHE_FILE']) - if os.path.exists(settings['M_MATH_CACHE_FILE']): - latex2svgextra.unpickle_cache(settings['M_MATH_CACHE_FILE']) - else: - latex2svgextra.unpickle_cache(None) + # Ensure that cache is unpickled again if M_MATH_CACHE_FILE is *not* set -- + # otherwise tests will sporadically fail. + if settings['M_MATH_CACHE_FILE'] and os.path.exists(settings['M_MATH_CACHE_FILE']): + latex2svgextra.unpickle_cache(settings['M_MATH_CACHE_FILE']) + else: + latex2svgextra.unpickle_cache(None) hooks_pre_page += [new_page] hooks_post_run += [save_cache] -- 2.30.2