Use pytestconfig instead of request.config in cache example (#11542)

to be consistent with the API documentation.
This commit is contained in:
Carsten Grohmann 2023-10-23 20:45:16 +02:00 committed by GitHub
parent bcd9664370
commit 38f7c1e346
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

3
changelog/11065.doc.rst Normal file
View File

@ -0,0 +1,3 @@
Use pytestconfig instead of request.config in cache example
to be consistent with the API documentation.

View File

@ -213,12 +213,12 @@ across pytest invocations:
@pytest.fixture
def mydata(request):
val = request.config.cache.get("example/value", None)
def mydata(pytestconfig):
val = pytestconfig.cache.get("example/value", None)
if val is None:
expensive_computation()
val = 42
request.config.cache.set("example/value", val)
pytestconfig.cache.set("example/value", val)
return val