Merge pull request #9416 from bluetech/doc-stash-fix

doc: fix a reference in "Writing hook functions"
(cherry picked from commit 443aa0219c)
This commit is contained in:
Ran Benita 2021-12-25 10:49:40 +02:00
parent 045713ac2e
commit 8f1a8800c8
1 changed files with 1 additions and 1 deletions

View File

@ -321,7 +321,7 @@ Plugins often need to store data on :class:`~pytest.Item`\s in one hook
implementation, and access it in another. One common solution is to just implementation, and access it in another. One common solution is to just
assign some private attribute directly on the item, but type-checkers like assign some private attribute directly on the item, but type-checkers like
mypy frown upon this, and it may also cause conflicts with other plugins. mypy frown upon this, and it may also cause conflicts with other plugins.
So pytest offers a better way to do this, :attr:`_pytest.nodes.Node.stash <item.stash>`. So pytest offers a better way to do this, :attr:`item.stash <_pytest.nodes.Node.stash>`.
To use the "stash" in your plugins, first create "stash keys" somewhere at the To use the "stash" in your plugins, first create "stash keys" somewhere at the
top level of your plugin: top level of your plugin: