Use pytest to parametrize some of the tests. #232
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.
This basically move the looping on multiple conditions from being the
test responsibility to being pytest's it has several advantages.
I find it make the test more redable as you only have to focus on
what you want to test.
In case of test failures it will have more informative message with
which sub-condition fails and will not stop on the first error,
usually allowing to narrow down the error case faster.
It allow to run a single subtest when fixing code (using the --lf, or
--ff pytest flags).
Show which subcase are slow with --durations=..., and could integrade
with multi-worker testing or randomisations.
It does have minimal drawbacks; but this does increase some of the setup
time which is now done sometime for each case instead of one per group.
use_threads seem to be used a lot, so I made it a module-scoped fixture,
a function only have to use the parameter use_threads to automatically
been generic over some parameters, other are ad-hoc.
I did not parametrize on everything as I mostly want to test if you are
ok with this approach.
This was initially push by trying to test current decode_partial in
blosc which is still in progress and was failing on a subset of cases.
GitHub note, the diff will me messy if you don't "ignore whitespace", most of the changes are de-indent and removal of for loops.
TODO:
tox -e py38
passes locallytox -e docs
passes locally