Skip to content

Commit 25d2cc4

Browse files
committed
Add docstring to cache fixture
Fixes pytest-dev#1049
1 parent 9d1ae0a commit 25d2cc4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

_pytest/cacheprovider.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,20 @@ def pytest_configure(config):
186186

187187
@pytest.fixture
188188
def cache(request):
189+
"""
190+
Return a cache object that can persist state between testing sessions.
191+
192+
cache.get(key, default)
193+
cache.set(key, value)
194+
195+
Keys must be strings not containing a "/" separator. Add a unique identifier
196+
(such as plugin/app name) to avoid clashes with other cache users.
197+
198+
Values can be any object handled by the json stdlib module.
199+
"""
189200
return request.config.cache
190201

202+
191203
def pytest_report_header(config):
192204
if config.option.verbose:
193205
relpath = py.path.local().bestrelpath(config.cache._cachedir)

0 commit comments

Comments
 (0)