Skip to content

Commit 5e9911a

Browse files
authored
[no-ci] Register pytest.mark authorship markers, add matching AGENTS.md instructions (#2245)
* docs: add pytest markers for test authorship * docs: keep test authorship markers local * docs: note synced authorship marker registries
1 parent 339d7c7 commit 5e9911a

5 files changed

Lines changed: 63 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,44 @@ repos/{owner}/{repo}/milestones --jq '.[].title'`, and pick the best match.
113113
end on clarifications unless truly blocked. Every rollout should conclude
114114
with a concrete edit or an explicit blocker plus a targeted question.
115115

116+
## Test authorship markers
117+
118+
Use pytest markers to make the provenance of newly added unit tests explicit.
119+
Keep this provenance system minimal: choose from only these three markers.
120+
Place the marker immediately above each test function. A class-level marker is
121+
acceptable only when every test method in the class has the same provenance.
122+
Do not use module-level `pytestmark` for authorship provenance; it is too easy
123+
to miss in large files and makes later per-test provenance changes ambiguous.
124+
125+
- `@pytest.mark.agent_authored(model="<model>")`: the test was authored by an
126+
agent and has not yet been materially reviewed or rewritten by a human.
127+
Agents must add this marker when generating new unit tests, for example:
128+
129+
```python
130+
import pytest
131+
132+
@pytest.mark.agent_authored(model="gpt-5.5")
133+
def test_something():
134+
...
135+
```
136+
137+
- `@pytest.mark.human_reviewed`: a human has materially reviewed or rewritten
138+
an agent-authored test. Prefer replacing
139+
`@pytest.mark.agent_authored(model="<model>")` with this marker instead of
140+
keeping both.
141+
- `@pytest.mark.human_authored`: the test was authored by a human, or
142+
rewritten enough that the authorship is primarily human.
143+
144+
Use at most one authorship marker per test. Treat missing markers as legacy or
145+
unknown provenance, not as implicit `@pytest.mark.human_authored`. Because
146+
these are pytest markers, tests can be selected with `pytest -m`, for example
147+
`pytest -m agent_authored`.
148+
149+
When an agent notices a human adding a new test or materially modifying an
150+
existing test, suggest adding `@pytest.mark.human_authored` or replacing
151+
`@pytest.mark.agent_authored(model="<model>")` with
152+
`@pytest.mark.human_reviewed` as appropriate.
153+
116154

117155
# Editing constraints
118156

cuda_bindings/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ required_plugins = "pytest-benchmark"
9292
addopts = "--benchmark-disable --showlocals"
9393
norecursedirs = ["tests/cython", "examples"]
9494
xfail_strict = true
95+
# Keep this authorship marker registry in sync across all pytest config roots.
96+
# Search for "agent_authored(model)" before editing.
97+
markers = [
98+
"agent_authored(model): agent-authored test not yet materially human-reviewed",
99+
"human_reviewed: agent-authored test materially reviewed or rewritten by a human",
100+
"human_authored: test authored primarily by a human",
101+
]
95102

96103
[tool.setuptools_scm]
97104
root = ".."

cuda_core/pytest.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
[pytest]
66
addopts = --showlocals
77
norecursedirs = cython
8+
markers =
9+
# Keep this authorship marker registry in sync across all pytest config roots.
10+
# Search for "agent_authored(model)" before editing.
11+
agent_authored(model): agent-authored test not yet materially human-reviewed
12+
human_reviewed: agent-authored test materially reviewed or rewritten by a human
13+
human_authored: test authored primarily by a human

cuda_pathfinder/pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--ma
104104
[tool.pytest.ini_options]
105105
addopts = "--showlocals"
106106
thread_unsafe_fixtures = ['mocker']
107+
# Keep this authorship marker registry in sync across all pytest config roots.
108+
# Search for "agent_authored(model)" before editing.
109+
markers = [
110+
"agent_authored(model): agent-authored test not yet materially human-reviewed",
111+
"human_reviewed: agent-authored test materially reviewed or rewritten by a human",
112+
"human_authored: test authored primarily by a human",
113+
]
107114

108115
[tool.mypy]
109116
# Try to keep the mypy configuration similar between the subprojects

pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ markers =
2020
core: tests for cuda_core
2121
cython: cython tests
2222
smoke: meta-level smoke tests
23+
# Keep this authorship marker registry in sync across all pytest config roots.
24+
# Search for "agent_authored(model)" before editing.
25+
agent_authored(model): agent-authored test not yet materially human-reviewed
26+
human_reviewed: agent-authored test materially reviewed or rewritten by a human
27+
human_authored: test authored primarily by a human
2328
flaky: mark test as flaky (provided by pytest-rerunfailures)
2429
# pytest-run-parallel related markers
2530
thread_unsafe: mark test as thread unsafe (provided by pytest-run-parallel)

0 commit comments

Comments
 (0)