-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathtox.ini
More file actions
186 lines (176 loc) · 7.43 KB
/
Copy pathtox.ini
File metadata and controls
186 lines (176 loc) · 7.43 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
[tox]
requires =
tox>=4.24
tox-uv>=1.20
# coverage env excluded from parallel runs — invoked separately by run_all_tests.sh
env_list = unit, integration, e2e, admin, bdd, ui
skip_missing_interpreters = true
# ─── Base test environment ───────────────────────────────────────
[testenv]
runner = uv-venv-lock-runner
dependency_groups = dev
package = editable
pass_env =
DATABASE_URL
ADCP_SALES_PORT
POSTGRES_PORT
GEMINI_API_KEY
ENCRYPTION_KEY
ADCP_TESTING
ADCP_AUTH_TEST_MODE
CREATE_SAMPLE_DATA
CREATE_DEMO_TENANT
DELIVERY_WEBHOOK_INTERVAL
COMPOSE_PROJECT_NAME
SUPER_ADMIN_EMAILS
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
PYTEST_CURRENT_TEST
BDD_E2E_ENABLED
E2E_BASE_URL
E2E_POSTGRES_URL
E2E_DATABASE_URL
E2E_PER_WORKER
ADCP_TEST_HOST
ADCP_TEST_DB_HOST
ADCP_TEST_DB_PORT
ADCP_WEBHOOK_HOST
PLAYWRIGHT_BROWSERS_PATH
PYTEST_XDIST_AUTO_NUM_WORKERS
BDD_XDIST_N
BDD_E2E_XDIST_N
UNIT_XDIST_N
INTEGRATION_XDIST_N
TEST_DB_TEMPLATE
TEST_DB_SKIP_DROP
CREATIVE_AGENT_URL
CREATIVE_AGENT_PORT
ALLOW_LIVE_CREATIVE_AGENT
PYTHONPYCACHEPREFIX
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
# ─── Unit tests (DATABASE_URL must be UNSET) ────────────────────
[testenv:unit]
description = Unit tests (no database, no server)
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
DATABASE_URL =
commands =
pytest tests/unit/ tests/harness/ \
-n {env:UNIT_XDIST_N:0} \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/unit.json --json-report-indent=2 \
-q --tb=line {posargs}
# ─── Integration tests ──────────────────────────────────────────
[testenv:integration]
description = Integration tests (needs PostgreSQL)
commands =
pytest tests/integration/ \
-n {env:INTEGRATION_XDIST_N:0} --dist {env:INTEGRATION_DIST:loadfile} \
-m "not skip_ci" \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/integration.json --json-report-indent=2 \
-p no:randomly \
-q --tb=line {posargs}
# ─── E2E tests ──────────────────────────────────────────────────
[testenv:e2e]
description = End-to-end tests (needs full Docker stack)
# E2E talks to the SERVER's database (/adcp), not the suite DB (/adcp_test). In
# the in-network runner the server DB lives at postgres:5432/adcp, exported as
# E2E_DATABASE_URL; on the host path E2E_DATABASE_URL is unset and we keep the
# inherited DATABASE_URL the e2e stack already provides. Per-suite override so
# integration/bdd/admin (which share this runner) still see /adcp_test.
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
DATABASE_URL = {env:E2E_DATABASE_URL:{env:DATABASE_URL:}}
commands =
pytest tests/e2e/ \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/e2e.json --json-report-indent=2 \
-q --tb=line {posargs}
# ─── Admin UI tests ──────────────────────────────────────────────
[testenv:admin]
description = Admin UI tests (needs full Docker stack)
commands =
pytest tests/admin/ \
-m "not slow" \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/admin.json --json-report-indent=2 \
-q --tb=line {posargs}
# ─── UI smoke tests (Playwright) ───────────────────────────────
[testenv:ui]
description = UI smoke tests via Playwright (needs full Docker stack + browser)
extras = ui-tests
# UI drives the browser against the running server and seeds the SERVER's
# database (/adcp) — same per-suite DB split as e2e. In-network the browser
# binary is pre-baked (PLAYWRIGHT_BROWSERS_PATH); commands_pre is then a no-op.
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
DATABASE_URL = {env:E2E_DATABASE_URL:{env:DATABASE_URL:}}
commands_pre =
playwright install chromium
commands =
pytest tests/ui/ \
--browser chromium \
--json-report --json-report-file={toxworkdir}/ui.json --json-report-indent=2 \
-q --tb=short {posargs}
# ─── BDD behavioral tests ──────────────────────────────────────
[testenv:bdd]
description = BDD behavioral tests (pytest-bdd; xdist on host, serial in-network)
# Worker count is env-controlled. Host: BDD_XDIST_N unset -> "auto" (parallel).
# In-network: BDD_XDIST_N=0 -> truly serial, no xdist subprocess. Required because
# (a) all bdd workers share ONE live Postgres in e2e mode (xdist races on it), and
# (b) under xdist the BDD_E2E_ENABLED env doesn't reach the worker's
# pytest_generate_tests, so the e2e_rest (5th) transport is silently dropped.
# -n0 runs collection in-process, so e2e_rest is parametrized and there's no race.
commands =
pytest tests/bdd/ \
-n {env:BDD_XDIST_N:auto} --dist {env:BDD_DIST:loadfile} \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/bdd.json --json-report-indent=2 \
-q --tb=line {posargs}
# ─── BDD two-pass split (fast full runs) ────────────────────────
# The full `bdd` env above runs all transports serially (required when e2e_rest
# is on). For fast runs, run_all_tests.sh expands `bdd` -> `bdd_inprocess,bdd_e2e`
# so the in-process bulk parallelizes and only e2e_rest stays on the shared server.
[testenv:bdd_inprocess]
description = BDD in-process transports (a2a/mcp/rest), parallel (per-test DBs isolate)
setenv =
{[testenv]setenv}
BDD_E2E_ENABLED = false
commands =
pytest tests/bdd/ \
-n {env:BDD_XDIST_N:auto} --dist {env:BDD_DIST:load} \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/bdd_inprocess.json --json-report-indent=2 \
-q --tb=line {posargs}
# e2e_rest transport only (real HTTP -> nginx -> live server). Serial for now
# (one shared server + /adcp DB); goes parallel via BDD_E2E_XDIST_N once per-worker
# server stacks land and the xdist guard is relaxed.
[testenv:bdd_e2e]
description = BDD e2e_rest transport only (real HTTP to the live server)
setenv =
{[testenv]setenv}
BDD_E2E_ENABLED = true
commands =
pytest tests/bdd/ -k e2e_rest \
-n {env:BDD_E2E_XDIST_N:0} \
--cov=src --cov-report= \
--json-report --json-report-file={toxworkdir}/bdd_e2e.json --json-report-indent=2 \
-q --tb=line {posargs}
# ─── Coverage combine + report ──────────────────────────────────
[testenv:coverage]
description = Combine coverage from all suites and generate reports
skip_install = true
deps = coverage[toml]
depends = unit, integration, e2e, admin, bdd
parallel_show_output = true
allowlist_externals =
bash
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage
commands =
coverage combine {toxworkdir}
bash {toxinidir}/scripts/ci/coverage_report.sh
coverage html -d {toxinidir}/htmlcov
coverage json -o {toxinidir}/coverage.json