diff --git a/.gitignore b/.gitignore index 0d682a3c0219c2db7927409475794ea058ca3a64..299ebbfa5242d6427b1b6343d0b7b69570f006dd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,6 @@ __pycache__/ *.egg-info/ .env .tox -report.xml +*.xml +.coverage + diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 188e39cd883d1c6a36cb016df0283bc59f80b74d..3e99d558df8f62db7296f8073e1c64dac08d759e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,13 @@ test: script: - pip install tox - tox -e py38 + artifacts: + reports: + coverage_report: + coverage_format: cobertura + path: coverage.xml + junit: + - report.xml deploy_uniformgrid_gpu: stage: deploy diff --git a/pyproject.toml b/pyproject.toml index 3f1c32f27a53932edaea72fd6d5f674dea0a09af..6ec0cc36c57d253249eef1f745ab26d43c8d7a71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ description="Collection of scripts and wrapper of contious benchmarking" readme = "README.md" requires-python = ">=3.8" authors = [ - { name = "Christoph Alt", email="christoph.alt@fau.de" } +{ name = "Christoph Alt", email="christoph.alt@fau.de" } ] license = { file = "LICENSE" } @@ -26,10 +26,24 @@ plotting = [ dashboard = [ "grafanalib", ] -test = ["pytest"] +test = [ + "coverage", + "pytest", + "pytest-cov" +] [project.scripts] get_frequency = "cbutil.cpu_frequency:main" [tools.setuptools] packages = ["cbutil", "cbutil.postprocessing", "dashboards", "plotting"] + +[tool.coverage.run] +branch = true +source = ["cbutil", "dashboards", "plotting"] +exclude_lines = [ + "if __name__ == __main__", +] + +[tool.coverage.html] +directory = "coverage_html_report" diff --git a/tox.ini b/tox.ini index 711b6c812bd9c3f58c9352a6d34439807050a4c4..db9c694b3144b46042fae6e3051df5f4436b55e3 100644 --- a/tox.ini +++ b/tox.ini @@ -3,4 +3,6 @@ envlist = py38, py310, py311 [testenv] extras = dashboard, plotting, test -commands = pytest --junitxml=report.xml +commands = + pytest --junitxml=report.xml + pytest --cov --cov-report html --cov-report term --cov-report xml