Automatically write .gitignore to cache dir, ignoring everything - #8193
Conversation
| self.fscache = fscache | ||
| self.find_module_cache = FindModuleCache(self.search_paths, self.fscache, self.options) | ||
| self.metastore = create_metastore(options) | ||
| if fscache.isdir(options.cache_dir): |
There was a problem hiding this comment.
I would suggest adding the .gitignore file only on creating the cache directory, as I wouldn't be surprised if some people store it in git intentionally. With this they would have to delete the .gitignore file every run. But I will wait for other's opinions before making this change.
There was a problem hiding this comment.
Sure, why not, 90013eb should take care of it. Also using os.path.isdir instead of fscache.isdir as metastore creates dirs without updating fscache's stat cache.
msullivan
left a comment
There was a problem hiding this comment.
I'll take this, but could you move the logic out of __init__ into a helper.
I'd also skip using the the fscache at all here. We really just use it for source files.
Also, just try creating the file instead of doing a separate, racy existence check.
|
Done. I get an unrelated flake8 failure in my Travis tests, but I guess that might go away once rebased. Would you like me to do that BTW, and maybe squash the commits while at it? Not sure about the preferred PR/review flow here. |
|
I'll squash it when I merge the PR, which I will do now. Thank you! |
Kudos to pytest for the idea.
pytest-dev/pytest#3286 (comment)