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

Python test coverage needs improvement #755

Open
jelmer opened this issue Dec 31, 2021 · 8 comments
Open

Python test coverage needs improvement #755

jelmer opened this issue Dec 31, 2021 · 8 comments
Labels
improvement Not a new feature, but makes Isso more pleasant to use needs-contributor Someone needs to implement this. Help wanted! server (Python) server code testing/ci Test coverage & GitHub actions etc.
Milestone

Comments

@jelmer
Copy link
Member

jelmer commented Dec 31, 2021

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.

@jelmer jelmer added the needs-contributor Someone needs to implement this. Help wanted! label Dec 31, 2021
@ix5
Copy link
Member

ix5 commented Dec 31, 2021

To elaborate, the python unit tests are in isso/tests/.

To run Isso's unit tests, you can use python -m unittest discover isso/tests (or pytest installed via pip install pytest). - Edit: Simply run make test

We should probably update the docs that still recommend using nose since it won't run on current python versions and is abandoned by its creators. - Edit: Done

Any contributors experienced in python or unit testing are welcome to help out!

@Guts
Copy link
Contributor

Guts commented Jan 4, 2022

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.

@jelmer
Copy link
Member Author

jelmer commented Jan 4, 2022

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.

@Guts
Copy link
Contributor

Guts commented Jan 4, 2022

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.

@jelmer
Copy link
Member Author

jelmer commented Jan 4, 2022

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.

@Guts
Copy link
Contributor

Guts commented Jan 5, 2022

No worries, I get it that we agree.

I've pushed a PR.

@ix5
Copy link
Member

ix5 commented Feb 17, 2022

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?

@ix5
Copy link
Member

ix5 commented Mar 27, 2022

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%

@ix5 ix5 modified the milestones: 0.13, open-ended May 24, 2022
@ix5 ix5 added server (Python) server code testing/ci Test coverage & GitHub actions etc. improvement Not a new feature, but makes Isso more pleasant to use labels Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Not a new feature, but makes Isso more pleasant to use needs-contributor Someone needs to implement this. Help wanted! server (Python) server code testing/ci Test coverage & GitHub actions etc.
Projects
None yet
Development

No branches or pull requests

3 participants