-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivityreporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Description
What's the problem this feature will solve?
"I have a test class that defines setup_class and teardown_class methods. I need to execute some specific configuration or cleanup code before the teardown_class method itself is invoked.
My current observation is that the teardown logic within a scope="class" fixture runs after the teardown_class method has already completed. How can I ensure my custom code (e.g., within a class scope fixture's teardown) reliably executes prior to the teardown_class method?"
Describe the solution you'd like
To implement "callbacks" or "hooks" that execute before teardown_class and teardown_module in pytest, the recommended and most effective solution is to utilize pytest fixtures with the yield keyword and appropriate scoping.
Alternative Solutions
Additional context
Metadata
Metadata
Assignees
Labels
status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivityreporter needs to provide more information; can be closed after 2 or more weeks of inactivity