RF: Use Mixin class for extraction tests #191
Merged
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.
When we have tests which are common across multiple objects to test, a handy way of doing this is to make multiple subclasses with different setup but the same test methods. When making the parent subclass, we want it to contain a list of all the tests to run and no set up, and not actually get run itself. We can't subclass BaseTestCase directly because then it is a subclass of unittest.TestCase and will automatically be collected by pytest. Our solution is to use multiple inheritance with a Mixin class. However, the previous way of doing this was not quite doing Mixin classes correctly and it wasn't triggering both parent's
__init__
methods. This resolves the situation into a correct Mixin class. c.f. https://stackoverflow.com/a/50465583/1960959