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

Add branch coverage, improve overall coverage #356

Closed
bollwyvl opened this issue Mar 28, 2021 · 3 comments
Closed

Add branch coverage, improve overall coverage #356

bollwyvl opened this issue Mar 28, 2021 · 3 comments

Comments

@bollwyvl
Copy link
Collaborator

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

@jorisvandenbossche
Copy link
Member

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 ✨ Using sphinx toc functions #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).

@bollwyvl bollwyvl mentioned this issue Apr 9, 2021
10 tasks
@12rambau
Copy link
Collaborator

12rambau commented Jan 3, 2024

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.

@drammock
Copy link
Collaborator

drammock commented Jan 3, 2024

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

@drammock drammock closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants