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 coverage report and badge on README.md #88

Open
luclaurent opened this issue Oct 10, 2024 · 2 comments · May be fixed by #92
Open

Add coverage report and badge on README.md #88

luclaurent opened this issue Oct 10, 2024 · 2 comments · May be fixed by #92
Assignees
Labels
ci About CI evolution. enhancement

Comments

@luclaurent
Copy link
Collaborator

Consider adding test coverage score on README.md using badge. See genbadge, Github Actions (1, 2)

@nennigb
Copy link
Owner

nennigb commented Nov 28, 2024

It is a good idea.

a first local run, yields

Name                                        Stmts   Miss  Cover
---------------------------------------------------------------
amc2moodle/__init__.py                          4      0   100%
amc2moodle/_version.py                          1      0   100%
amc2moodle/amc2moodle/__init__.py               0      0   100%
amc2moodle/amc2moodle/amc2moodle_class.py     163     22    87%
amc2moodle/amc2moodle/convert.py              441     39    91%
amc2moodle/amc2moodle/test.py                 194     13    93%
amc2moodle/moodle2amc/__init__.py               2      0   100%
amc2moodle/moodle2amc/_questions.py           317     37    88%
amc2moodle/moodle2amc/_quiz.py                113      9    92%
amc2moodle/moodle2amc/test.py                  29      2    93%
amc2moodle/utils/__init__.py                    0      0   100%
amc2moodle/utils/calculatedParser.py          224     39    83%
amc2moodle/utils/customLogging.py              79     32    59%
amc2moodle/utils/flatex.py                     56      2    96%
amc2moodle/utils/text.py                       17      0   100%
---------------------------------------------------------------
TOTAL                                        1640    195    88%

which is not too bad. Nonetheless, we also should improve some tests which test only the execution but not the quality of the output eg, test_Elements.
The other missing part is to test the exceptions.

I use Coverage.py:

coverage run --data-file=cov-amc2moodle -m  amc2moodle.amc2moodle.test
coverage run --data-file=cov-moodle2amc -m  amc2moodle.moodle2amc.test
coverage combine cov-amc2moodle cov-moodle2amc 
coverage report

I suggest to do that when we will update the packaging system.

@luclaurent
Copy link
Collaborator Author

Great, we can use coverage.py directly in hatch as package management system: https://hatch.pypa.io/1.13/tutorials/testing/overview/#measuring-code-coverage

@luclaurent luclaurent linked a pull request Nov 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci About CI evolution. enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants