Skip to content

gh-106368: Improve coverage reports for argument clinic - #107693

Merged
AlexWaygood merged 1 commit into
python:mainfrom
AlexWaygood:clinic-coverage
Aug 6, 2023
Merged

AlexWaygood merged 1 commit into
python:mainfrom
AlexWaygood:clinic-coverage

Conversation

@AlexWaygood

@AlexWaygood AlexWaygood commented Aug 6, 2023 •

Copy link
Copy Markdown
Member
  • Use ... rather than pass for empty bodies in abstract methods that are never meant to be executed. Exclude lines consisting solely of ... in our .coveragerc file.
  • Use raise AssertionError instead of raise RuntimeError for an exception that's never meant to be executed -- it would indicate a bug in Tools/clinic/ itself, rather than an incorrect usage of argument clinic, if that line was ever executed. Exclude raise AssertionError( lines in our .coveragerc file.
  • A reasonably large block of code in Tools/clinic/cpp.py was being excluded from coverage reports because it was all inside an if __name__ == "__main__" block, and if __name__ == "__main__" blocks are excluded in our .coveragerc file. That was making our coverage for cpp.py look better than it actually was. Move that block inside a _main() function so that it's correctly reported as being uncovered in coverage reports.
Comment thread Tools/clinic/clinic.py Resolved

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AlexWaygood
AlexWaygood merged commit ee3bf45 into python:main Aug 6, 2023
@AlexWaygood
AlexWaygood deleted the clinic-coverage branch August 6, 2023 19:40
kostyafarber pushed a commit to kostyafarber/cpython that referenced this pull request Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants