pydata-sphinx-theme
pydata-sphinx-theme copied to clipboard
Add branch coverage, improve overall coverage
With #352, we now have a baseline established for code coverage under test.
Adding --cov-branch knocks down the effective coverage by a couple points, and reveals some places where multiple conditionals within a given function might affect each other.
Further, 66% isn't awe-inspiring, and it should be possible to substantially improve this value... and most likely find some new bugs along the way.
A powerful tool for confidently increasing coverage without adding many little tests is property-based testing, for which hypothesis is the really the only game in python-town. Property-based testing is very effective at finding lots of failing cases by trying lots of (crazy) cases, but crucially reduces a class of failures to a minimal example.
I'll take a look and see what I can find...
Further, 66% isn't awe-inspiring, and it should be possible to substantially improve this value
One note here, the large "uncovered" areas in the code are:
BootstrapHTML5Translator.visit_table, because we have no table in our test rst- The
get_nav_objectandget_page_toc_objectthat are injected incontext: I added those back for backwards compatibility in https://github.com/pydata/pydata-sphinx-theme/pull/219, but are also simply not explicitly tested at the moment
And also get_edit_url isn't tested.
I think all of those can also use explicit tests (testing expected result / html).
The tests are now (v0.15.0) using --cov-branch parameter and we reached 87% of coverage. I think it covers the expectations of this issue.
Let me know if I can close it.
I think we can close. It can always be better, but 87% coverage is much better than 66% :)