[maint] Reduce likelihood of creating dependent tests from fixtures #425
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change
Restructure the fixtures around the default json objects to reduce the chance of accidentally creating dependent tests. In the current situation:
This means that if you're not careful, you can end up modifying the state for other tests.
Now, we separate out loading from disk (once per session) to creating the dictionary (once per test), removing the ability to persist state across tests. Note that a single test can still (indirectly) request the same fixture twice, in which case there still needs to be a precaution not to modify the dicts directly.
How to Test
Run the tests, think things through. Alternatively, the following tests will pass on develop but not on this branch:
if
test_a
runs beforetest_b
, thentest_b
will pass (on develop). Iftest_a
isn't run, or run aftertest_b
, then it fails (on develop). On this branchtest_b
will always fail, sincebody_concept
is now a function-level fixture.Checklist
Related Issues