mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 02:31:45 +01:00
feat: introduce smoke test group and fail-fast test orchestration (#572)
This commit is contained in:
@@ -106,12 +106,35 @@ lint = { composite = ["lint:ruff", "lint:mypy", "lint:pyright"] }
|
||||
"lint:fix" = {shell = "ruff check --preview --fix" }
|
||||
|
||||
# tests
|
||||
test = "python -m pytest --capture=tee-sys"
|
||||
utest = "python -m pytest --capture=tee-sys -m 'not itest'"
|
||||
itest = "python -m pytest --capture=tee-sys -m 'itest'"
|
||||
"test:cov" = { composite = ["utest:cov", "itest:cov"] }
|
||||
"utest:cov" = { composite = ["utest --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-unit.xml"] }
|
||||
"itest:cov" = { composite = ["itest --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-integration.xml"] }
|
||||
# Run unit tests only (exclude smoke and itest)
|
||||
utest = "python -m pytest --capture=tee-sys -m \"not itest and not smoke\""
|
||||
# Run integration tests only (exclude smoke)
|
||||
itest = "python -m pytest --capture=tee-sys -m \"itest and not smoke\""
|
||||
# Run smoke tests only
|
||||
smoke = "python -m pytest --capture=tee-sys -m smoke"
|
||||
# Run all tests in order: unit, integration, smoke
|
||||
# (for CI: run these three scripts in sequence)
|
||||
test = { composite = ["utest", "itest", "smoke"] }
|
||||
# Run all tests in a single invocation for unified summary (unit tests run first)
|
||||
"test:unified" = "python -m pytest --capture=tee-sys"
|
||||
#
|
||||
# Coverage scripts:
|
||||
# - Each group writes its own data file to .temp/.coverage.<group>.xml
|
||||
#
|
||||
"test:cov" = { composite = ["utest:cov", "itest:cov", "smoke:cov", "coverage:combine"] }
|
||||
"utest:cov" = { shell = "python -m pytest --capture=tee-sys -m \"not itest and not smoke\" --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-unit.xml --cov-append" }
|
||||
"itest:cov" = { shell = "python -m pytest --capture=tee-sys -m \"itest and not smoke\" --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-integration.xml --cov-append" }
|
||||
"smoke:cov" = { shell = "python -m pytest --capture=tee-sys -m smoke --cov=src/kleinanzeigen_bot --cov-report=xml:.temp/coverage-smoke.xml --cov-append" }
|
||||
"coverage:combine" = { shell = "coverage report -m" }
|
||||
# Run all tests with coverage in a single invocation
|
||||
"test:cov:unified" = "python -m pytest --capture=tee-sys --cov=src/kleinanzeigen_bot --cov-report=term-missing"
|
||||
|
||||
# Test script structure:
|
||||
# - Composite test groups (unit, integration, smoke) are run in order to fail fast and surface critical errors early.
|
||||
# - This prevents running all tests if a foundational component is broken, saving time.
|
||||
# - Each group is covered and reported separately.
|
||||
#
|
||||
# See docs/TESTING.md for more details.
|
||||
|
||||
|
||||
#####################
|
||||
@@ -322,6 +345,7 @@ addopts = """
|
||||
--cov-report=term-missing
|
||||
"""
|
||||
markers = [
|
||||
"smoke: marks a test as a high-level smoke test (critical path, no mocks)",
|
||||
"itest: marks a test as an integration test (i.e. a test with external dependencies)",
|
||||
"asyncio: mark test as async"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user