Skip to content

Update AGENTS.md and harden tests/_docs_codeblocks.py #222

Done

Description

@tony

Summary

Three small follow-up housekeeping items remained out of scope for #219 and #220: AGENTS.md still describes README.md as >>>-only doctests, _make_sandbox_env in tests/_docs_codeblocks.py inherits PYTEST_ADDOPTS from the outer environment into inner pytest subprocesses, and _run_fire_evidence_command leaves rg output unsorted compared with its fallback branch.

Motivation

  • AGENTS.md describes README.md as Doctested quickstart — every >>> block is a real test, even though docs(readme): Refresh quickstart and cut boxes #220 replaced README.md's >>> doctests with plain python and runnable console fences executed by tests/_docs_codeblocks.py.
  • _make_sandbox_env strips COVERAGE_PROCESS_START and COV_CORE_SOURCE from child subprocesses, but leaves PYTEST_ADDOPTS intact; an externally exported PYTEST_ADDOPTS (such as -k, -m documentation, or --junitxml) can alter or break inner pytest runs launched for plain python test blocks and runnable pytest console blocks.
  • In _run_fire_evidence_command, the no-rg fallback sorts evidence_dir.rglob("fire.json"), whereas the rg branch compares raw rg --files line order against cmd.expected_output, which is non-deterministic across filesystems and thread scheduling if multi-line expected output is added to a FIRE console block.

Proposal

  • Update the README.md row in AGENTS.md to reflect that README.md code blocks run via tests/_docs_codeblocks.py alongside doctests.
  • Clear PYTEST_ADDOPTS (env.pop("PYTEST_ADDOPTS", None)) inside _make_sandbox_env in tests/_docs_codeblocks.py, with a unit test confirming an exported PYTEST_ADDOPTS does not affect inner pytest execution.
  • Sort normalized lines in the rg branch of _run_fire_evidence_command so its output order matches the sorted(evidence_dir.rglob("fire.json")) fallback.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions