Repository navigation
Expand file tree
/
Copy pathpytest.ini
More file actions
198 lines (192 loc) · 11.2 KB
/
Copy pathpytest.ini
File metadata and controls
198 lines (192 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
[pytest]
# AutoBot pytest configuration
# Ensure backend and shared modules are importable before collection starts.
# pytest processes `pythonpath` before any test collection, so bare imports
# like `from models.task_context import ...` resolve correctly.
# Requires pytest >= 7.0 (built-in mechanism; more reliable than conftest.py
# sys.path manipulation which runs too late to prevent collection errors).
# Issue: #1884
# pipeline-scripts (#13880): its tests do bare imports of their subject
# (`import audit_unwired_trackers`), and --import-mode=importlib below does NOT
# put a test's own directory on sys.path. Collecting that directory without
# this entry fails every shard at import time.
# .claude/skills/claims-audit (#14986): its four suites import their subjects
# bare (`from verifiers import ...`, `from file_issues import ...`). The
# directory cannot become an importable package path -- neither `.claude` nor
# `claims-audit` is a Python identifier -- so #13086's pkgutil.extend_path
# route does not transfer, and --import-mode=importlib does not put a test's
# own directory on sys.path. This is the same entry `pipeline-scripts` gets
# above and for the same reason. It replaces three sys.path.insert calls that
# resolved only because an earlier-collected sibling ran first.
#
# It is declared BEFORE the SDK entry below on purpose: that one is required
# to stay last (see its note), and this one has no ordering requirement of its
# own -- claims-audit publishes `verifiers`, `file_issues`, `generate_report`
# and a JSON-only `patterns/`, none of which shadows anything (#14986).
# libs/autobot-sdk-python (#13286): `libs/autobot-sdk-python/tests/test_integration.py`
# carries `pytestmark = pytest.mark.integration` and was selected by no workflow until
# marker-tests.yml gained that root. Its first run reported four
# `ModuleNotFoundError: No module named 'autobot_sdk'` — the SDK package sits under
# `libs/autobot-sdk-python/`, which nothing put on the path. That is a packaging gap,
# not a product one, so it is fixed here rather than marked around. The top-level name
# `autobot_sdk` is unique in this repository, so that name collides with nothing.
#
# ORDER IS LOAD-BEARING, and this entry must stay LAST. `libs/autobot-sdk-python`
# also holds a `tests/__init__.py`, so it publishes a top-level `tests` package,
# and five backend e2e modules do `from tests.test_helpers import ...` expecting
# `autobot-backend/tests`. pytest inserts these entries in declared order, so the
# backend wins as written; moving this entry earlier would repoint those imports
# silently, and the error would name the helper rather than this line.
# repo_tests/marker_suite_root_coverage_test.py fails if the order changes.
pythonpath = . autobot-backend autobot_shared pipeline-scripts .claude/skills/claims-audit libs/autobot-sdk-python
# Test markers
markers =
integration: Integration tests that may require external services
requires_backend: Tests written against a running backend API (autobot-infrastructure harness)
slow: Tests that take a long time to run
distributed: Tests for distributed multi-VM scenarios
performance: Performance and load tests
security: Security-related tests
real_kb: Tests that run against a real (in-memory) ChromaDB instance
migration_gate: Alembic migration-path tests requiring a disposable Postgres (#10001/#10026)
xdist_group: pytest-xdist group marker — tests with the same group run on the same worker
e2e: End-to-end tests exercising a full service stack (#13549)
high_priority: Release-blocking security and test-coverage assertions (#13549)
reach_floor: Reach floors checked against the LIVE tree — one full sweep per declaration, so
pre-push deselects them and CI runs them (#17810). The empty-tree proof is NOT marked.
llm_judge: LLM-judged quality assertions — skipped unless AUTOBOT_LLM_JUDGE_TESTS=1 and a provider is configured (#11521)
# Test discovery - colocated tests live next to source files (#734)
# #12501: added autobot-tts-worker — its tests/ mirror tts-worker.py.j2
# template logic in isolation (no torch/pocket_tts needed) and were
# previously never collected by CI.
#
# #13084: autobot-backend/ and autobot-slm-backend/ each define top-level
# packages with identical names (api, services, user_management, middleware,
# migrations). Running ALL of testpaths in ONE pytest invocation makes
# whichever backend collects first bind those dotted names in sys.modules for
# the rest of the session, breaking the other backend's own tests. A full
# local/CI run MUST use two separate invocations instead of a single bare
# `pytest`: one covering `autobot-backend autobot_shared autobot-tts-worker
# repo_tests`, a second covering `autobot-slm-backend` alone (see
# .github/workflows/ci.yml's "Run unit tests with coverage gate" step).
# Running a single test file/directory under either backend is unaffected.
#
testpaths =
autobot-backend
autobot-slm-backend
autobot-tts-worker
autobot_shared
repo_tests
# #13368: `tools/` holds 215 passing tests (lint checkers, codemods) that
# nothing ran — it was absent here, so CI collected none of them and a
# broken one could not be noticed. Its own tests import via the package
# path (`tools.lint.*`, `tools.codemods.*`), which resolves because both
# `tools/__init__.py` files call pkgutil.extend_path (#13086).
tools
# #13879: ci.yml has passed `scripts` to pytest for a while, but testpaths
# never listed it — so a bare local `pytest` silently skipped every test in
# there. The two lists had drifted, which is how a red test hides.
scripts
# #13880: same defect as #13368 one directory over — `pipeline-scripts/`
# holds tests for the CI guard wrappers and nothing collected them, so a
# test that had been red for as long as the bug it covered went unnoticed.
# A guard's own test must run, or the guard is unverified twice over.
pipeline-scripts
# #14884: the same defect a third time, and the sharpest case of it. The 18
# suites under autobot-infrastructure/shared/scripts/hooks/ are the ONLY
# tests of the pre-commit hooks themselves, and nothing collected them: not
# this list, not any of the three CI invocations, and not
# autobot-infrastructure/shared/tests/pytest.ini (whose `testpaths = unit
# integration e2e` does not reach shared/scripts/). So `git worktree list`
# failing closed, and the supply-chain check on tag-pinned third-party
# actions, were both guarded by tests that ran nowhere. 159 tests, measured
# green before wiring — this is a wiring fix, not a quarantine.
#
# NARROW ON PURPOSE. `autobot-infrastructure` as a whole does NOT collect:
# 23 collection errors when this was measured. The second reason recorded
# here -- shared/scripts/test_alertmanager.py calling sys.exit(0) at import
# and killing pytest with an INTERNALERROR -- is SPENT: #14917 put it behind
# a main() guard (see its lines 15 and 67-68). Widening is #15476 (#15178).
autobot-infrastructure/shared/scripts/hooks
# #14986: the four suites here hold 42 test functions CI had never run,
# because this list is an allowlist and `.claude` was not on it. The skill
# is repo tooling whose findings are used in review, so the #13368 argument
# for `tools/` applies unchanged -- and measuring it proved the point: 6 of
# the 42 were red, against real defects in the verifiers (a truncated
# endpoint path, a subject extractor that returned "the", two config
# phrasings that reached no verifier, an infrastructure category no
# verifier claimed, and a citation stripped down to a basename). All six
# are fixed and all 42 pass.
#
# NARROW ON PURPOSE, like the hooks entry above. `.claude/` as a whole does
# NOT collect: it is harness territory, and on a working checkout it holds
# agent scratch that is not always parseable Python. The imports resolve
# through this file's `pythonpath` entry, not through a sys.path shim in
# each module, and `verifiers/test_verifier.py` -- test-shaped by
# `python_files` but an implementation -- declares `__test__ = False`
# rather than being renamed out of its package's `<kind>_verifier.py`
# convention.
.claude/skills/claims-audit
# #15051: `autobot-infrastructure/shared/tests` and `libs` were named by NO
# pytest invocation in any workflow and by no entry here, so a bare local
# `pytest` skipped 28 tests in silence -- 12 of them marker-carrying (later
# picked up by marker-tests.yml's third invocation, #13286) and 17 selected
# by nothing at all, ever, not even the marker suite. Re-measured on this
# branch: 11 of the original 28 gained a module-level `pytestmark` since
# (#14979/#15166), leaving 17 (13 in test_architecture_compliance.py, 4 in
# test_redis_db_ssot.py) that ran nowhere until this entry.
#
# Both roots named together, like the hooks/claims-audit pairs above: `libs`
# carries `libs/autobot-sdk-python/tests`, whose `test_integration.py` needs
# `libs/autobot-sdk-python` on `pythonpath` (already last on that list, see
# above) to import `autobot_sdk` at all -- and #15161 found that pytest's
# rootdir resolution only lands on the repository root's own pytest.ini
# when `autobot-infrastructure/shared/tests` is invoked ALONGSIDE a sibling
# path outside it, which every root already on this list provides.
autobot-infrastructure/shared/tests
libs
# #7082: dropped `*.e2e_test.py` / `*.integration_test.py` (dotted) — they
# break pytest's path-to-module conversion. Files renamed to `*_e2e_test.py`
# / `*_integration_test.py` / `*_performance_test.py` (underscore form),
# which all fall under the `*_test.py` pattern below.
python_files = test_*.py *_test.py
python_classes = Test*
python_functions = test_*
# Exclude directories that are not real test code:
# - autobot-slm-backend/ansible/ contains Ansible-synced node copies with duplicate tests
# - autobot-npu-worker/resources/ contains Windows-only tests requiring PySide6
# - Standard tooling/cache directories
norecursedirs =
.git
.tox
.venv
venv
__pycache__
node_modules
.worktrees
dist
build
*.egg-info
# Output options
addopts =
--verbose
--strict-markers
--tb=short
--asyncio-mode=auto
--import-mode=importlib
--ignore=autobot-slm-backend/ansible
--ignore=autobot-npu-worker/resources
# pytest-xdist parallelism (-n auto --dist loadscope) is applied per
# full-suite invocation (the ci.yml coverage gate), NOT globally here:
# several CI jobs (e.g. startup-import-smoke) install bare pytest without
# pytest-xdist and run from this rootdir, so a global -n in addopts would
# error them with "unrecognized arguments: -n" and break a required gate.
# Proven stable with --dist loadscope (#10398).
# Coverage options
# Run with: pytest --cov=autobot-backend --cov=autobot-slm-backend --cov-report=html
#
# The [coverage:run] / [coverage:report] sections that used to live here have
# MOVED to .coveragerc (#10691). They were inert in this file: coverage.py reads
# only .coveragerc, .coveragerc.toml, setup.cfg, tox.ini and pyproject.toml —
# never pytest.ini — so `omit` and `fail_under` here never applied. Do not add
# them back here; edit .coveragerc.