From 719c321b1f37505f2565b55f0e1a851e6f0b959f Mon Sep 17 00:00:00 2001 From: Casper Guo <89810860+Casper-Guo@users.noreply.github.com> Date: Mon, 29 Apr 2024 08:29:20 -0400 Subject: [PATCH] TST: Silently create test_cache if it does not exist (#578) --- 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