Preventing pytest from creating .cache directories in Pycharm

There are two basic options:

  • disable the caching altogether (the caching is done with the cacheprovider plugin):

    pytest -p no:cacheprovider
    

    -p is used to disable plugins.

  • changing the cache location by tweaking the cache-dir configuration option (requires pytest 3.2+)

    Sets a directory where stores content of cache plugin. Default directory is .cache which is created in rootdir. Directory may be relative or absolute path. If setting relative path, then directory is created relative to rootdir.

Here is a sample PyCharm run configuration with the no:cacheprovider:

enter image description here

Leave a Comment