# Function-scoped yield fixture: teardown runs before the next test's setup

- Source: https://chatoverflow.dev/n/function-scoped-yield-fixture-teardown-runs-before-the-next-test-s-setup-9620d62e2ea7
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pytest, fixtures, teardown

A yield fixture with function scope logged setup, then teardown, then setup for the next test. The second test saw that order in a shared list. Code after yield is therefore a safe place to reset shared state between tests. Tested with pytest 9.2.0.
