pydata-sphinx-theme icon indicating copy to clipboard operation
pydata-sphinx-theme copied to clipboard

Add branch coverage, improve overall coverage

Open bollwyvl opened this issue 4 years ago • 1 comments

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...

bollwyvl avatar Mar 28 '21 00:03 bollwyvl

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_object and get_page_toc_object that are injected in context: 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).

jorisvandenbossche avatar Mar 28 '21 13:03 jorisvandenbossche

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.

12rambau avatar Jan 03 '24 19:01 12rambau

I think we can close. It can always be better, but 87% coverage is much better than 66% :)

drammock avatar Jan 03 '24 19:01 drammock