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

Track code coverage #24

Merged
merged 2 commits into from Jan 17, 2022
Merged

Track code coverage #24

merged 2 commits into from Jan 17, 2022

Conversation

florimondmanca
Copy link
Collaborator

@florimondmanca florimondmanca commented Jan 13, 2022

Closes #21

Cette PR ajoute pytest-cov pour vérifier la couverture de tests. J'ai mis une couverture min à 90%.

Si on le souhaite on peut éventuellement utiliser un service comme CodeCov pour un suivi plus instrumenté, avec le bot GitHub qui vient fail la PR si le coverage diminue... À voir, faisons simple pour l'instant.

Coverage à date :

============================= test session starts ==============================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/florimond/dev/prj-catalogue/catalogage-donnees, configfile: setup.cfg, testpaths: tests
plugins: asyncio-0.16.0, cov-3.0.0, anyio-3.4.0
collected 17 items

tests/test_app.py .                                                      [  5%]
tests/api/test_auth.py ..............                                    [ 88%]
tests/api/test_datasets.py .                                             [ 94%]
tests/domain/test_datasets.py .                                          [100%]

---------- coverage: platform linux, python 3.8.12-final-0 -----------
Name                                             Stmts   Miss  Cover   Missing
------------------------------------------------------------------------------
server/__init__.py                                   0      0   100%
server/api/__init__.py                               0      0   100%
server/api/app.py                                   11      0   100%
server/api/auth/__init__.py                          2      0   100%
server/api/auth/dependencies.py                     14      2    86%   19-20
server/api/auth/routes.py                           29      7    76%   25-29, 34-37
server/api/auth/schemas.py                          10      0   100%
server/api/datasets/__init__.py                      2      0   100%
server/api/datasets/routes.py                       37      4    89%   34-35, 45-46
server/api/datasets/schemas.py                       7      0   100%
server/api/routes.py                                11      0   100%
server/api/security.py                               2      0   100%
server/application/__init__.py                       0      0   100%
server/application/auth/__init__.py                  0      0   100%
server/application/auth/commands.py                  6      0   100%
server/application/auth/handlers.py                 25      9    64%   18-22, 26-27, 37-40
server/application/auth/queries.py                   4      0   100%
server/application/datasets/__init__.py              0      0   100%
server/application/datasets/commands.py              6      0   100%
server/application/datasets/handlers.py             23      3    87%   33-36
server/application/datasets/queries.py               8      0   100%
server/config/__init__.py                            2      0   100%
server/config/di.py                                 48      0   100%
server/config/settings.py                           22      0   100%
server/domain/__init__.py                            0      0   100%
server/domain/auth/__init__.py                       0      0   100%
server/domain/auth/entities.py                       7      0   100%
server/domain/auth/exceptions.py                     6      0   100%
server/domain/auth/repositories.py                   8      0   100%
server/domain/common/__init__.py                     0      0   100%
server/domain/common/exceptions.py                   5      0   100%
server/domain/common/types.py                        1      0   100%
server/domain/datasets/__init__.py                   0      0   100%
server/domain/datasets/entities.py                   7      0   100%
server/domain/datasets/exceptions.py                 3      0   100%
server/domain/datasets/repositories.py               9      0   100%
server/infrastructure/__init__.py                    0      0   100%
server/infrastructure/adapters/__init__.py           0      0   100%
server/infrastructure/adapters/json.py               9      4    56%   7-9, 13
server/infrastructure/adapters/messages.py          18      2    89%   26-27
server/infrastructure/auth/__init__.py               0      0   100%
server/infrastructure/auth/module.py                 7      0   100%
server/infrastructure/auth/repositories.py          34     11    68%   28-33, 39-40, 43-46
server/infrastructure/database.py                   13      0   100%
server/infrastructure/datasets/__init__.py           0      0   100%
server/infrastructure/datasets/module.py             7      0   100%
server/infrastructure/datasets/repositories.py      40      9    78%   28, 35-40, 48-49, 55
server/main.py                                       4      4     0%   1-6
server/seedwork/application/__init__.py              0      0   100%
server/seedwork/application/commands.py              5      0   100%
server/seedwork/application/messages.py              7      1    86%   11
server/seedwork/application/modules.py               5      0   100%
server/seedwork/application/queries.py               5      0   100%
server/seedwork/application/types.py                 5      0   100%
server/seedwork/domain/__init__.py                   0      0   100%
server/seedwork/domain/entities.py                   3      0   100%
server/seedwork/domain/repositories.py               6      0   100%
tests/__init__.py                                    0      0   100%
tests/api/__init__.py                                0      0   100%
tests/api/test_auth.py                              29      0   100%
tests/api/test_datasets.py                          25      0   100%
tests/conftest.py                                   38      0   100%
tests/domain/__init__.py                             0      0   100%
tests/domain/test_datasets.py                       21      0   100%
tests/test_app.py                                    7      0   100%
------------------------------------------------------------------------------
TOTAL                                              603     56    91%

Required test coverage of 90% reached. Total coverage: 90.71%

============================== 17 passed in 1.08s ==============================

@florimondmanca
Copy link
Collaborator Author

Les lignes pas couvertes donnent déjà des indications sur des tests manquants (tests unitaires surtout). On pourra gérer ça dans des PR à part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test coverage
1 participant