Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RF: Use Mixin class for extraction tests #191

Merged
merged 5 commits into from Jun 20, 2021

Conversation

scottclowe
Copy link
Member

@scottclowe scottclowe commented Jun 20, 2021

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

@scottclowe scottclowe changed the title Rf test extraction RF: Use Mixin class for extraction tests Jun 20, 2021
@codecov
Copy link

codecov bot commented Jun 20, 2021

Codecov Report

Merging #191 (20867d9) into master (e95420b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #191   +/-   ##
=======================================
  Coverage   93.08%   93.08%           
=======================================
  Files           8        8           
  Lines         911      911           
  Branches      188      188           
=======================================
  Hits          848      848           
  Misses         32       32           
  Partials       31       31           
Flag Coverage Δ
unittests 92.97% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e95420b...20867d9. Read the comment docs.

@scottclowe scottclowe merged commit adea698 into rochefort-lab:master Jun 20, 2021
@scottclowe scottclowe deleted the rf_test-extraction branch June 20, 2021 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant