chore: add pytest-cov and CI workflow

Add GitHub Actions workflow for running tests with coverage on Python 3.8 and 3.11.

Configure pytest-cov, coverage thresholds and expand testpaths in pyproject.toml.

Update .gitignore for .ruff_cache, .mypy_cache, *.egg-info and .coverage.
This commit is contained in:
dw-0
2026-07-11 00:26:49 +02:00
parent 7b5522ac94
commit 861cb2bff4
4 changed files with 73 additions and 3 deletions
+36
View File
@@ -0,0 +1,36 @@
name: Tests
on:
push:
branches: [develop, master]
pull_request:
branches: [develop, master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests with coverage
run: pytest --cov=kiauh --cov-report=xml --cov-report=term
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
+4
View File
@@ -1,6 +1,8 @@
.idea
.vscode
.pytest_cache
.ruff_cache
.mypy_cache
.jupyter
*.ipynb
*.ipynb_checkpoints
@@ -10,5 +12,7 @@ __pycache__
.venv
*.code-workspace
*.iml
*.egg-info
.coverage
kiauh.cfg
klipper_repos.txt
+32 -3
View File
@@ -1,13 +1,19 @@
[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "kiauh"
version = "0.0.0"
requires-python = ">=3.8"
[project.optional-dependencies]
dev=["ruff", "mypy", "pytest"]
dev = ["ruff", "mypy", "pytest", "pytest-cov"]
[tool.ruff]
required-version = ">=0.9.10"
respect-gitignore = true
exclude = [".git",".github", "./docs"]
exclude = [".git", ".github", "./docs"]
line-length = 88
indent-width = 4
output-format = "full"
@@ -24,6 +30,8 @@ extend-select = ["I"]
[tool.mypy]
python_version = "3.8"
platform = "linux"
explicit_package_bases = true
mypy_path = "kiauh"
check_untyped_defs = true
ignore_missing_imports = true
warn_redundant_casts = true
@@ -31,7 +39,28 @@ warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
[tool.coverage.report]
fail_under = 65
skip_covered = false
[tool.pytest.ini_options]
minversion = "8.2.1"
testpaths = ["kiauh/core/simple_config_parser/tests", "kiauh/utils/tests"]
testpaths = [
"kiauh/components/klipper/services/tests",
"kiauh/components/moonraker/services/tests",
"kiauh/components/moonraker/utils/tests",
"kiauh/components/webui_client/services/tests",
"kiauh/components/webui_client/tests",
"kiauh/components/webui_client/menus/tests",
"kiauh/core/backends/tests",
"kiauh/core/cli/tests",
"kiauh/core/instance_manager/tests",
"kiauh/core/menus/tests",
"kiauh/core/services/tests",
"kiauh/core/settings/tests",
"kiauh/core/simple_config_parser/tests",
"kiauh/extensions/tests",
"kiauh/tests",
"kiauh/utils/tests",
]
pythonpath = ["kiauh"]
+1
View File
@@ -1,3 +1,4 @@
ruff (>=0.9.10)
mypy
pytest
pytest-cov