mirror of
https://github.com/dw-0/kiauh.git
synced 2026-08-03 12:57:53 +05:00
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:
@@ -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
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
.ruff_cache
|
||||||
|
.mypy_cache
|
||||||
.jupyter
|
.jupyter
|
||||||
*.ipynb
|
*.ipynb
|
||||||
*.ipynb_checkpoints
|
*.ipynb_checkpoints
|
||||||
@@ -10,5 +12,7 @@ __pycache__
|
|||||||
.venv
|
.venv
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
*.iml
|
*.iml
|
||||||
|
*.egg-info
|
||||||
|
.coverage
|
||||||
kiauh.cfg
|
kiauh.cfg
|
||||||
klipper_repos.txt
|
klipper_repos.txt
|
||||||
|
|||||||
+32
-3
@@ -1,13 +1,19 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=61", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
|
name = "kiauh"
|
||||||
|
version = "0.0.0"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.8"
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
dev=["ruff", "mypy", "pytest"]
|
dev = ["ruff", "mypy", "pytest", "pytest-cov"]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
required-version = ">=0.9.10"
|
required-version = ">=0.9.10"
|
||||||
respect-gitignore = true
|
respect-gitignore = true
|
||||||
exclude = [".git",".github", "./docs"]
|
exclude = [".git", ".github", "./docs"]
|
||||||
line-length = 88
|
line-length = 88
|
||||||
indent-width = 4
|
indent-width = 4
|
||||||
output-format = "full"
|
output-format = "full"
|
||||||
@@ -24,6 +30,8 @@ extend-select = ["I"]
|
|||||||
[tool.mypy]
|
[tool.mypy]
|
||||||
python_version = "3.8"
|
python_version = "3.8"
|
||||||
platform = "linux"
|
platform = "linux"
|
||||||
|
explicit_package_bases = true
|
||||||
|
mypy_path = "kiauh"
|
||||||
check_untyped_defs = true
|
check_untyped_defs = true
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
warn_redundant_casts = true
|
warn_redundant_casts = true
|
||||||
@@ -31,7 +39,28 @@ warn_unused_ignores = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
|
|
||||||
|
[tool.coverage.report]
|
||||||
|
fail_under = 65
|
||||||
|
skip_covered = false
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
minversion = "8.2.1"
|
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"]
|
pythonpath = ["kiauh"]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
ruff (>=0.9.10)
|
ruff (>=0.9.10)
|
||||||
mypy
|
mypy
|
||||||
pytest
|
pytest
|
||||||
|
pytest-cov
|
||||||
|
|||||||
Reference in New Issue
Block a user