Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1bf6a11b authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Merge branch 'coverage' into 'develop'

Compute coverage as part of CI/CD.

See merge request !38
parents 34779af9 d6fe02b4
No related branches found
No related tags found
1 merge request!38Compute coverage as part of CI/CD.
Pipeline #778598 canceled
......@@ -12,6 +12,11 @@ test:
script:
- pip install -U tox
- tox -e py38
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules:
- if: ($CI_PIPELINE_SOURCE == "push") &&
(($CI_COMMIT_BRANCH == "develop") || ($CI_COMMIT_BRANCH =~ "/^r\d\.\d+/"))
......@@ -26,6 +31,11 @@ test-full:
script:
- pip install -U tox
- tox -e py38 -- --fulltest
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event") &&
($CI_MERGE_REQUEST_TITLE !~ /^Draft:.*/)
......
......@@ -86,6 +86,7 @@ tests = [
"pylint >= 2.14",
"pytest >= 6.1",
"pytest-asyncio",
"pytest-cov >= 4.0",
]
[project.urls]
......@@ -96,6 +97,21 @@ repository = "https://gitlab.inria.fr/magnet/declearn/declearn2.git"
line-length = 79
extend-exclude = "(.*_pb2.*py$)" # exclude auto-generated protobuf code files
[tool.coverage.run]
# enable coverage collection within multiprocessing
concurrency = ["multiprocessing"]
parallel = true
sigterm = true
# define rules to select the code files that need covering
source_pkgs = ["declearn"]
omit = [
"**/grpc/protobufs/*.py", # auto-generated rotobuf code files
"**/test_utils/*.py", # dev-only test-oriented utils
]
[tool.coverage.paths]
source = ["declearn", ".tox/**/declearn"]
[tool.mypy]
exclude = [".*_pb2.*.py$"]
follow_imports = "skip" # otherwise excluded files are checked
......
......@@ -12,11 +12,15 @@ allowlist_externals =
commands=
# run unit tests first
pytest {posargs} \
--cov --cov-report= \ # reset then accumulate coverage quietly
--ignore=test/functional/ \
test
# run functional tests (that build on units)
pytest {posargs} \
--cov --cov-append --cov-report=term \ # acc. and display coverage
test/functional/
# export the finalized coverage report to xml
coverage xml
# verify code acceptance by pylint
pylint declearn
pylint --recursive=y test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment