_pytest.cacheprovider module¶
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically ignores the external pytest-cache
-
class
Cache
(cachedir: pathlib.Path, config: _pytest.config.Config)[source]¶ Bases:
object
-
_CACHE_PREFIX_DIRS
= 'd'¶
-
_CACHE_PREFIX_VALUES
= 'v'¶
-
classmethod
clear_cache
(cachedir: pathlib.Path)[source]¶ Clears the sub-directories used to hold cached directories and values.
-
makedir
(name)[source]¶ 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.
-
get
(key, default)[source]¶ 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
key – must be a
/
separated value. Usually the first name is the name of your plugin or your application.default – must be provided in case of a cache-miss or invalid cache values.
-
-
class
LFPluginCollWrapper
(lfplugin: _pytest.cacheprovider.LFPlugin)[source]¶ Bases:
object
-
class
LFPluginCollSkipfiles
(lfplugin: _pytest.cacheprovider.LFPlugin)[source]¶ Bases:
object
-
pytest_make_collect_report
(collector) → Optional[_pytest.reports.CollectReport][source]¶
-
-
class
LFPlugin
(config: _pytest.config.Config)[source]¶ Bases:
object
Plugin which implements the –lf (run last-failing) option
-
get_last_failed_paths
() → Set[pathlib.Path][source]¶ Returns a set with all Paths()s of the previously failed nodeids.
-
for ... in
pytest_collection_modifyitems
(config: _pytest.config.Config, items: List[_pytest.nodes.Item]) → Generator[None, None, None][source]¶
-
-
class
NFPlugin
(config)[source]¶ Bases:
object
Plugin which implements the –nf (run new-first) option
-
for ... in
pytest_collection_modifyitems
(items: List[_pytest.nodes.Item]) → Generator[None, None, None][source]¶
-
for ... in
-
pytest_configure
(config: _pytest.config.Config) → None[source]¶
-
cache
(request)[source]¶ Return a cache object that can persist state between testing sessions.
cache.get(key, default) cache.set(key, value)
Keys must be a
/
separated value, where the first part is usually the name of your plugin or application to avoid clashes with other cache users.Values can be any object handled by the json stdlib module.
-
pytest_report_header
(config: _pytest.config.Config) → Optional[str][source]¶ Display cachedir with –cache-show and if non-default.