Open luclaurent opened 1 month ago
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.
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
Consider adding test coverage score on README.md using badge. See
genbadge
, Github Actions (1, 2)