cache module¶
Patch for pytest cache to serialize datetime.datetime
-
cache.
json_iso_datetimes
(obj: Any) → str[source]¶ JSON serializer for objects not serializable by default json module.
-
cache.
json_iso_datetime_string_to_datetime
(obj: Dict[Any, Any]) → Dict[Any, Any][source]¶ JSON object hook that converts object vals from ISO datetime strings to python datetime.datetime`s if possible.
-
cache.
datetime_encode_set
(self: _pytest.cacheprovider.Cache, key: str, value: Union[str, int, float, Dict[Any, Any], Tuple[Any]]) → None[source]¶ save value for the given key.
- Parameters
key – must be a
/
separated value. Usually the first name is the name of your plugin or your application.value – must be of any combination of basic python types, including nested types like e. g. lists of dictionaries.
-
cache.
datetime_encode_get
(self: _pytest.cacheprovider.Cache, key: str, default: Any) → Any[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.