Repository navigation
R23-T056: Move test_abs_val into doctests and reach 100% coverage for maths/abs.py - #66
Open
code-paul-creator wants to merge 1 commit into
Open
code-paul-creator wants to merge 1 commit into
code-paul-creator wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Explores how CI collects and reports on
maths/abs.py(doctests vs thetest_abs_val()function) and closes the coverage gap:test_abs_val's assertions become doctests, and the__main__block, which pytest never runs, is marked# pragma: no cover.Related Issue
Fixes: #56
Type of Change
Changes Made
maths/abs.py: added doctests toabs_val,abs_min,abs_max,abs_max_sort(the cases fromtest_abs_val), removedtest_abs_val()and its call in__main__, marked the__main__block# pragma: no cover(same convention asciphers/skytale_cipher.py).work/R23-T056/CI_NOTES.md: how CI runs pytest (flags,--ignore, coverage), the collected test IDs,DIRECTORY.md/build_directory_md.py/validate_filenames.pybehaviour, and the coverage before/after output.work/R23-T056/coverage_before.txt,coverage_after.txt: full pytest-cov output.Screenshots / Recordings
Not applicable (no UI changes).
Testing
python -m pytest maths/abs.py --cov=maths --cov-report=term-missing -v-> before: 6 items, abs.py below 100% (lines 89-94 missing); after: 4 items, abs.py 100%python -m pytest maths/test_abs.py -q-> passedruff check maths/abs.py-> all checks passedChecklist
Additional Notes
Findings:
pytest maths/abs.pycollects both the doctests and thetest_abs_valfunction (6 items), but CI-style collection (pytest .) collects only the doctests:abs.pydoes not matchtest_*.py, and--doctest-modulesis what picks it up, sotest_abs_valran only through its>>> test_abs_val()doctest. The coverage gap was the__main__block. Side note:abs_val(-0.0)returns-0.0while built-inabs(-0.0)is0.0(not changed). Details inwork/R23-T056/CI_NOTES.md.