From 531983f04768ac97d4dde354b117af91084b70e3 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Thu, 18 Jan 2024 21:04:10 +0100 Subject: [PATCH] Run coverage in CI with % check of coverage. (#1945) --- .github/workflows/ci.yml | 2 +- .gitignore | 1 + pyproject.toml | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bdda86e0..1a7f71c50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: - name: pytest run: | env - pytest -v --full-trace --timeout=1200 + pytest -v --cov --full-trace --timeout=1200 analyze: name: Analyze Python diff --git a/.gitignore b/.gitignore index 089b730b9..b4c3644f4 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ build/ /pymodbus.egg-info/ venv downloaded_files/ +htmlcov/ diff --git a/pyproject.toml b/pyproject.toml index df97ad241..790c65415 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -225,7 +225,7 @@ asyncio_mode = "auto" timeout = 40 [tool.coverage.run] -include = [ +source = [ "examples/", "pymodbus/", "test/", @@ -235,10 +235,15 @@ omit = ["examples/contrib/"] [tool.coverage.report] exclude_lines = [ "_check_system_health", - "if __name__ == .__main__.:", + "__main__", ] +skip_covered = true +fail_under = 86.0 + +[tool.coverage.html] +directory = "htmlcov" +skip_covered = true -ignore_errors = true [tool.codespell] skip = "./build,./doc/source/_static,venv,.venv,.git,htmlcov,CHANGELOG.rst,.mypy_cache"