theOehrly / Fast-F1

FastF1 is a python package for accessing and analyzing Formula 1 results, schedules, timing data and telemetry
https://docs.fastf1.dev
MIT License
2.29k stars 239 forks source link

Silently create test_cache if it does not exist #578

Closed Casper-Guo closed 2 months ago

Casper-Guo commented 2 months ago

If you are running tests locally and the test_cache directory hasn't been created before, enable_cache throws the following error:

NotADirectoryError: Cache directory does not exist! Please check for typos or create it first.

This is counter-intuitive as most contributors would have a cache enabled somewhere already.

Opening the PR to propose that this be handled silently (or with log output). The specific cache location might need to be changed to be consistent with the general fastf1 cache

theOehrly commented 2 months ago

I think it is fine to just create this local directory. So no need to use a different location for it.

But should we also add the "test_cache" folder to the .gitignore then? Else people might accidentally commit data from it.

Casper-Guo commented 2 months ago

.gitignore ignores all directories ending in "cache" so this is already covered

theOehrly commented 2 months ago

Oh right, then this looks good.