forked from molecule-ai/molecule-core
Merge pull request #2093 from Molecule-AI/test/python-coverage-floor-1817
test(workspace): centralize pytest-cov config + 92% floor (closes #1817)
This commit is contained in:
commit
f4cbb50ddf
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -283,7 +283,9 @@ jobs:
|
||||
cache: pip
|
||||
cache-dependency-path: workspace/requirements.txt
|
||||
- run: pip install -r requirements.txt pytest pytest-asyncio pytest-cov
|
||||
- run: python -m pytest --tb=short -q --cov=. --cov-report=term-missing
|
||||
# Coverage flags + fail-under floor moved into workspace/pytest.ini
|
||||
# (issue #1817) so local `pytest` and CI use identical config.
|
||||
- run: python -m pytest --tb=short
|
||||
|
||||
# SDK + plugin validation moved to standalone repo:
|
||||
# github.com/Molecule-AI/molecule-sdk-python
|
||||
|
||||
13
workspace/.coveragerc
Normal file
13
workspace/.coveragerc
Normal file
@ -0,0 +1,13 @@
|
||||
# coverage.py config — consumed by `pytest --cov` via the pytest-cov
|
||||
# plugin. Lives here (not in pytest.ini) because coverage.py only reads
|
||||
# .coveragerc / setup.cfg / tox.ini / pyproject.toml — the [coverage:*]
|
||||
# sections in pytest.ini are silently ignored. See issue #1817.
|
||||
[run]
|
||||
omit =
|
||||
*/tests/*
|
||||
*/__init__.py
|
||||
plugins_registry/*
|
||||
|
||||
[report]
|
||||
# Skip files at 100% in the term-missing output to keep CI logs readable.
|
||||
skip_covered = True
|
||||
@ -3,4 +3,24 @@ testpaths = tests
|
||||
python_files = test_*.py
|
||||
python_functions = test_*
|
||||
asyncio_mode = auto
|
||||
addopts = -q
|
||||
# Coverage config moved here from .github/workflows/ci.yml so local
|
||||
# `pytest` matches CI without operator-typed flags. cov-fail-under
|
||||
# pins the floor at 86% — 5pp below the 91.11% measured on staging
|
||||
# (run 24957664272, 2026-04-26). Floor exists so a regression that
|
||||
# drops coverage doesn't sneak past CI; tightening above 86% should
|
||||
# follow real measurement, not aspiration. See issue #1817.
|
||||
#
|
||||
# Why 86 not 92: the earlier 97% measurement was without the
|
||||
# .coveragerc omit list. Once `*/__init__.py`, `*/tests/*`, and
|
||||
# `plugins_registry/*` are excluded (the issue's prescribed omit
|
||||
# set, more meaningful since those files don't carry behavior),
|
||||
# the actual measurement of behavior-bearing code is 91.11% — and
|
||||
# 86% sits at the issue's prescribed `current - 5pp` margin.
|
||||
addopts =
|
||||
-q
|
||||
--cov=.
|
||||
--cov-report=term-missing
|
||||
--cov-fail-under=86
|
||||
# Coverage omit / report config lives in workspace/.coveragerc — coverage.py
|
||||
# only reads .coveragerc / setup.cfg / tox.ini / pyproject.toml, NOT
|
||||
# pytest.ini, so [coverage:*] sections here would be silently ignored.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user