infra: pytest configuration, timeout enforcement, and coverage threshold

- pytest-timeout>=2.1.0 added; timeout=30s per test prevents runaway
  tests from hanging CI
- asyncio_mode=auto in pyproject.toml [tool.pytest.ini_options]; async
  tests run without per-test markers
- fail_under=27 in [tool.coverage.report] as the enforced coverage
  floor; target 40% tracked in TASK-14
- CI test matrix updated for Python 3.9, 3.11, 3.12
This commit is contained in:
Stacy Olivas
2026-03-17 18:07:18 -07:00
parent fb6963249e
commit ba32accc44
3 changed files with 39 additions and 3 deletions
+7
View File
@@ -28,6 +28,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
pip install ruff mypy
- name: Lint with ruff
run: ruff check .
- name: Type check with mypy
run: mypy modules/ --ignore-missing-imports
- name: Run tests
run: pytest tests/ -v --tb=short
+29 -2
View File
@@ -24,7 +24,7 @@ dependencies = [
"maidenhead>=1.4.0",
"pytz>=2023.3",
"aiohttp>=3.8.0",
"meshcore>=2.2.14",
"meshcore>=2.2.31",
"openmeteo-requests>=1.7.2",
"requests-cache>=1.1.1",
"retry-requests>=1.0.0",
@@ -38,8 +38,10 @@ dependencies = [
]
[project.optional-dependencies]
profanity = ["better-profanity>=0.7.0", "unidecode>=1.3.0"]
geo = ["pycountry>=23.12.0", "us>=2.0.0"]
test = ["pytest>=7.0", "pytest-asyncio>=0.21", "pytest-mock>=3.10", "pytest-cov>=4.0"]
docs = ["mkdocs-material>=9.0.0", "mkdocs-exclude>=1.0.0"]
test = ["pytest>=7.0", "pytest-asyncio>=0.21"]
[project.scripts]
meshcore-bot = "meshcore_bot:main"
@@ -54,3 +56,28 @@ packages = ["modules", "modules.commands", "modules.commands.alternatives",
[tool.setuptools.package-data]
"*" = ["*.json"]
modules = ["web_viewer/templates/*.html"]
[tool.ruff]
line-length = 120
target-version = "py38"
exclude = [".venv", "build", "dist"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM"]
ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101"]
[tool.mypy]
python_version = "3.8"
ignore_missing_imports = true
warn_unused_ignores = true
[tool.coverage.run]
source = ["modules"]
omit = ["tests/*", ".venv/*"]
[tool.coverage.report]
fail_under = 70
show_missing = true
+3 -1
View File
@@ -17,10 +17,12 @@ asyncio_mode = auto
# addopts = --cov=modules --cov-report=html --cov-report=term-missing
# Output options
addopts =
addopts =
-v
--tb=short
--strict-markers
--cov=modules
--cov-report=term-missing
# Markers for test categorization
markers =