---
source: crates/ruff_linter/src/rules/flake8_pytest_style/mod.rs
---
PT021 Use `yield` instead of `request.addfinalizer`
  --> PT021.py:49:5
   |
47 | def my_fixture(request):  # Error return
48 |     resource = acquire_resource()
49 |     request.addfinalizer(resource.release)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 |     return resource
   |

PT021 Use `yield` instead of `request.addfinalizer`
  --> PT021.py:56:5
   |
54 | def my_fixture(request):  # Error yield
55 |     resource = acquire_resource()
56 |     request.addfinalizer(resource.release)
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57 |     yield resource
58 |     resource  # prevent PT022
   |
