From 4797afa7ced40a6b7916f81a1c02963589d7139b Mon Sep 17 00:00:00 2001 From: Casper Guo Date: Sun, 28 Apr 2024 23:10:46 -0400 Subject: [PATCH] Silently create test_cache if it does not exist --- conftest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/conftest.py b/conftest.py index 1cbbc0694..26a6afee7 100644 --- a/conftest.py +++ b/conftest.py @@ -134,6 +134,13 @@ def reference_laps_data(): def fastf1_setup(): import fastf1 from fastf1.logger import LoggingManager - fastf1.Cache.enable_cache('test_cache') # use specific cache directory + + try: + fastf1.Cache.enable_cache('test_cache') # use specific cache directory + except NotADirectoryError: + # create the test cache and re-enable + os.mkdir('test_cache') + fastf1.Cache.enable_cache('test_cache') + fastf1.Cache.ci_mode(True) # only request uncached data LoggingManager.debug = True # raise all exceptions