pytest-pickle-cache 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/PKG-INFO +1 -1
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/pyproject.toml +1 -1
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/src/pytest_pickle_cache/plugin.py +12 -1
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/.devcontainer/devcontainer.json +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/.devcontainer/postCreate.sh +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/.devcontainer/starship.toml +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/.gitignore +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/LICENSE +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/README.md +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/src/pytest_pickle_cache/__init__.py +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/tests/__init__.py +0 -0
- {pytest_pickle_cache-0.1.0 → pytest_pickle_cache-0.1.1}/tests/test_plugin.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pytest-pickle-cache
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: A pytest plugin for caching test results using pickle.
|
|
5
5
|
Project-URL: Documentation, https://daizutabi.github.io/pytest-pickle-cache/
|
|
6
6
|
Project-URL: Source, https://github.com/daizutabi/pytest-pickle-cache
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-pickle-cache"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.1"
|
|
8
8
|
authors = [{ name = "daizutabi", email = "daizutabi@gmail.com" }]
|
|
9
9
|
description = "A pytest plugin for caching test results using pickle."
|
|
10
10
|
readme = "README.md"
|
|
@@ -21,7 +21,18 @@ def use_cache(request: pytest.FixtureRequest) -> Callable[[str, Callable], Any]:
|
|
|
21
21
|
and deserialized using pickle and base64 encoding.
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
-
def use_cache(key: str, create: Callable[[],
|
|
24
|
+
def use_cache(key: str, create: Callable[[], Any]) -> Any:
|
|
25
|
+
"""Retrieve a cached result or execute the function if not cached.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
key (str): The key to identify the cached result.
|
|
29
|
+
func (Callable[[], Any]): The function to execute if the result is
|
|
30
|
+
not cached. The result of the function is serialized and stored
|
|
31
|
+
in the cache for future use.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
Any: The cached result or the result of the executed function.
|
|
35
|
+
"""
|
|
25
36
|
try:
|
|
26
37
|
if value := request.config.cache.get(key, None):
|
|
27
38
|
return pickle.loads(base64.b64decode(value))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|