isso
isso copied to clipboard
Python test coverage needs improvement
The test coverage for isso's Python code is very spotty; in order to be confident when making changes and adding features, we should make sure that all code at least has some degree of coverage.
To elaborate, the python unit tests are in isso/tests/.
To run Isso's unit tests, you can use - Edit: Simply run python -m unittest discover isso/tests
(or pytest
installed via pip install pytest
).make test
We should probably update the docs that still recommend using - Edit: Donenose
since it won't run on current python versions and is abandoned by its creators.
Any contributors experienced in python or unit testing are welcome to help out!
Maybe we could start by add a linter like flake8 to improve code reliability? We could also add it as a git hook through pr-commit to enforce code homogeneity and contributing guidelines?
If you want, I can push some PR.
Code linting and enforcing style seems like a good idea (and I'd welcome a PR to add that), but it is unrelated to better tests.
but it is unrelated to better tests.
Woo @jelmer, you are quite harsh! I see a static analysis tool (linter) as a good complementary first step to better tests since it aims at improving software quality.
My apologies, I didn't mean to come across as harsh. I'm not disagreeing with you about the usefulness of a linter in general and its potential contributions to code quality. But they're orthogonal, and a linter won't give us significantly more confidence merging new PRs.
No worries, I get it that we agree.
I've pushed a PR.
Maybe we could start by add a linter like flake8 to improve code reliability?
@Guts we already have flake8 (via make flakes
), would you care to modify the config (inside setup.cfg
so far) so that it catches more things?
As a reference point, this is the current coverage:
$ coverage report --omit='*/tests/*'
Name Stmts Miss Cover
-----------------------------------------------
isso/__init__.py 159 81 49%
isso/config.py 84 14 83%
isso/core.py 69 24 65%
isso/db/__init__.py 66 6 91%
isso/db/comments.py 135 19 86%
isso/db/preferences.py 17 0 100%
isso/db/spam.py 40 2 95%
isso/db/threads.py 15 0 100%
isso/dispatch.py 39 39 0%
isso/ext/__init__.py 10 0 100%
isso/ext/notifications.py 149 99 34%
isso/migrate.py 193 27 86%
isso/run.py 7 7 0%
isso/utils/__init__.py 66 11 83%
isso/utils/hash.py 58 1 98%
isso/utils/html.py 50 3 94%
isso/utils/http.py 35 24 31%
isso/utils/parse.py 42 2 95%
isso/views/__init__.py 35 8 77%
isso/views/comments.py 491 90 82%
isso/wsgi.py 87 17 80%
-----------------------------------------------
TOTAL 1847 474 74%