Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't delete FixtureDef.cached_result, set it to None instead
Previously `cached_result` was either set or deleted. Type annotations cannot handle this, so use `None` for the non-set state instead.
- Loading branch information
Showing
4 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when | ||
the result is unavailable, instead of being deleted. | ||
|
||
If your plugin perform checks like ``hasattr(fixturedef, 'cached_result')``, | ||
for example in a ``pytest_fixture_post_finalizer`` hook implementation, replace | ||
it with ``fixturedef.cached_result is not None``. If you ``del`` the attribute, | ||
set it to ``None`` instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters