diff --git a/changelog/11065.doc.rst b/changelog/11065.doc.rst new file mode 100644 index 000000000..70a3db92c --- /dev/null +++ b/changelog/11065.doc.rst @@ -0,0 +1,3 @@ +Use pytestconfig instead of request.config in cache example + +to be consistent with the API documentation. diff --git a/doc/en/how-to/cache.rst b/doc/en/how-to/cache.rst index 03ab0c777..1b2a454cc 100644 --- a/doc/en/how-to/cache.rst +++ b/doc/en/how-to/cache.rst @@ -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