Test runner
test_runner
Agent-optimized test runner with structured output.
Wraps pytest with pytest-json-report to produce compact,
token-efficient results for AI coding agents.
FailureDetail
dataclass
Structured detail for a single test failure.
Source code in packages/axm-audit/src/axm_audit/core/test_runner.py
error_type
instance-attribute
Exception class name, e.g. AssertionError.
file
instance-attribute
Relative file path.
line
instance-attribute
Line number of the assertion / raising statement.
message
instance-attribute
One-line error message.
test
instance-attribute
Full node ID, e.g. tests/unit/test_x.py::TestFoo::test_bar.
traceback
instance-attribute
Short traceback (truncated to _MAX_TB_LINES).
TestReport
dataclass
Compact test execution report.
Source code in packages/axm-audit/src/axm_audit/core/test_runner.py
run_tests(project_path, *, mode='failures', files=None, markers=None, stop_on_first=True, last_coverage=None)
Run tests with agent-optimized structured output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project_path
|
Path
|
Root of the project to test. |
required |
mode
|
TestMode
|
Output mode — |
'failures'
|
files
|
list[str] | None
|
Specific test files or paths to run. |
None
|
markers
|
list[str] | None
|
Pytest markers to filter ( |
None
|
stop_on_first
|
bool
|
Stop on first failure ( |
True
|
last_coverage
|
dict[str, float] | None
|
Previous per-file coverage dict for delta mode. |
None
|
Returns:
| Type | Description |
|---|---|
TestReport
|
Structured |
Source code in packages/axm-audit/src/axm_audit/core/test_runner.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |