Finer grain fixture scope than function #9699
Labels
topic: fixtures
anything involving fixtures directly or indirectly
type: proposal
proposal for a new feature, often to gather opinions or design the API around the new feature
What's the problem this feature will solve?
I'm testing some pandas refactoring code. I have an original data frame and old code that creates a new dataframe (actually mutates the original), and new code (that doesn't mutate the original).
I want to use the original data as a fixture for both the old and new code. However, because they both depend on the fixture that is function scoped, it is only created once and the mutation code messes up the test.
Here's an example (using Lists instead of DataFrames):
Output:
Describe the solution you'd like
I would propose a finer grain scope that function. Not sure of the name?
every
? If a fixture has this score and a single test function references the fixture multiple times then each fixture is a fresh invocation.The text was updated successfully, but these errors were encountered: