hud-python icon indicating copy to clipboard operation
hud-python copied to clipboard

Coding cookbook: example test_command loads a conftest.py left by the agent

Open fayaz316 opened this issue 2 weeks ago • 0 comments

What were you building?

I was working through the coding-agent cookbook (docs/v6/cookbooks/coding-agent.mdx) and checked how its example test_command handles files an agent leaves in the repository.

What got in the way?

The example uses python -m pytest -q test_parser.py --junitxml={junit_path} with a top-level test_path. Grading only restores test_path and .git, so a conftest.py the agent leaves in the repository root sits next to the test file and is loaded during grading. Its hooks can change test outcomes before the JUnit report is written.

A local check with the example's layout and the repo's own score_tests / parse_junit (a wrong solution that fails the fail-to-pass test; same result over 3 runs):

Command Correct Wrong Wrong + root conftest.py
current example 1.0 0.5 1.0
-I -c /dev/null --rootdir=. --confcutdir=. 1.0 0.5 1.0
-I -c /dev/null --rootdir=. --noconftest 1.0 0.5 0.5

The bundled flask tasks are not affected: they use a tests/ directory with --confcutdir=tests, which gives 0.5 in the same check. The gap is that the cookbook says the setup prevents the agent from weakening the grader, while the example it shows does not.

A possible docs fix: use --noconftest in the example (or a test_path directory with --confcutdir) and add a sentence on why. I'm happy to open a PR for it if this is useful.

fayaz316 avatar Nov 21 '26 21:11 fayaz316