The pytest-cache plugin adds a config.cache object during the configure-initialization of pytest. This allows other plugins, including conftest.py files, to safely and flexibly store and retrieve values across test runs because the config object is available in many places.
Under the hood, the cache plugin uses the simple dumps/loads API of the cross-interpreter execnet communication library. It makes it safe to store values e. g. under Python2 and retrieve it later from a Python3 or PyPy interpreter.
return cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned.
Parameters: |
|
---|
save value for the given key.
Parameters: |
|
---|
return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files likes e. g. store/retrieve database dumps across test sessions.
Parameters: | name – must be a string not containing a / separator. Make sure the name contains your plugin or application identifiers to prevent clashes with other cache users. |
---|