Independent tests
What does the merge request do?
Make unit tests generated out of ComparisonMixin
individually callable. As unit tests collection happens by class inspection - the test classes are instantiated later - afaics the only way to do this is through a meta class, as parametrisation of TestCase derived classes doesn't work in pytest.
Usually, the tests are generated as cross product of comparisons
and compare_file
, as was already the case. For details see documentation: https://joneuhauser.gitlab.io/-/extensions/-/jobs/4767449256/artifacts/build/html/source/inkex.tester.html#inkex.tester.ComparisonMixin
Implementation notes
A few changes were required to make the tests run with this change:
- The
ColorList
extension didn't properly reset its state when it was run, so that the values accumulated in multiple tests. This was split into its own commit. - The
LoremIpsum
andJitterNodes
have an inherently random output, and thus the output of those tests directly depended on the order they were run in. - The mechanism to specify the output file name from
TestHershey
was promoted into the superclass, so this code was removed. - For the other extensions, the generation of IDs was - similarly to Lorem Ipsum - dependent on the order the tests were run in.
Side note: Changing the order of the comparisons
entries now has no effect anymore since pytest calls the generated functions in alphabetic order.
Summary for release notes
Improvements to the unit testing framework for stock extensions.
Checklist
-
Add unit tests (if applicable) -
Changes to inkex/
are well documented -
Clean merge request history