agentleFS
docxologydocxology/template/tests/AGENTS.md

template / tests

AGENTS.md20 starsChanged 3 months agoApache-2.0View on GitHub

The tests/ directory contains repository-wide tests for infrastructure, integrations, and behavioral contracts that cross module boundaries. scripts/audit/verify_no_mocks.py defaults to the enforced lexical gate. Exit 0 proves that prohibited mock-framework imports and calls are absent; it does not prove that every dependency is real. Run --inventory to classify pytest.monkeypatch operations. setenv, delenv, and chdir are reported as environment isolation, while setattr, setitem, and their deletion variants are conservatively reported as dependency-replacement debt. CI and pre-push enforce a zero ceiling for dependency…

The file

We split this AGENTS.md into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use real data and real execution paths.

    line 9
  2. Very specific:

    Do not use mock frameworks (unittest.mock, MagicMock, mocker.patch) or replace the unit under test with fake behavior.

    line 10
  3. Distinctive:

    Prefer subprocess calls for CLI behavior.

    line 12
  4. Distinctive:

    Use temporary files and directories for filesystem behavior.

    line 13
  5. Distinctive:

    Use HTTP test servers for HTTP behavior.

    line 14
  6. Very specific:

    Default slug `template_test is the canonical synthetic stand-in.

    line 50
  7. Distinctive:

    Keep README.md files aligned with the live test tree.

    line 63
  8. Distinctive:

    Keep per-folder AGENTS.md files accurate and specific to the folder they document.

    line 64
  9. Very specific:

    Canonical: Run one pytest process per projects/<name>/tests/ tree.

    line 68

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

tests/ - Repository Test Documentation

Purpose

The tests/ directory contains repository-wide tests for infrastructure, integrations, and behavioral contracts that cross module boundaries.

Standards

  • Use real data and real execution paths.
  • Do not use mock frameworks (unittest.mock, MagicMock, mocker.patch) or replace the unit under test with fake behavior.
  • pytest.monkeypatch is acceptable for environment variables, current working directories, import paths, and test-server URLs when the test still exercises real code paths.
  • Prefer subprocess calls for CLI behavior.
  • Use temporary files and directories for filesystem behavior.
  • Use HTTP test servers for HTTP behavior.

Automated gate versus semantic inventory

scripts/audit/verify_no_mocks.py defaults to the enforced lexical gate. Exit 0 proves that prohibited mock-framework imports and calls are absent; it does not prove that every dependency is real. Run --inventory to classify pytest.monkeypatch operations. setenv, delenv, and chdir are reported as environment isolation, while setattr, setitem, and their deletion variants are conservatively reported as dependency-replacement debt. CI and pre-push enforce a zero ceiling for dependency replacements; environment isolation is reported separately and remains permitted.

uv run python scripts/audit/verify_no_mocks.py
uv run python scripts/audit/verify_no_mocks.py --inventory --max-dependency-replacements 0

Current Subtrees

  • tests/_support/ - shared test helpers (canonical ephemeral project scaffold factory)
  • tests/infra_tests/ - infrastructure module coverage
  • tests/integration/ - end-to-end and orchestration coverage
  • tests/regression/ - pinned-value regression tier (real exemplar projects only)

Synthetic project scaffold factory

Infrastructure and integration tests that need a minimum-valid project tree under tmp_path should use tests/_support/projects.py:

  • make_project(root, name="template_test", ...) — one project under projects/<name>/ or projects/<program>/<name>/ (pass program="templates" for qualified names like templates/template_test).
  • make_repo(root, names=(...)) — repository root with multiple synthetic projects.
  • repo_layout=False — standalone project at <root>/<name>/ (integration fixtures).

Default slug template_test is the canonical synthetic stand-in. Do not create a git-tracked template_test project under projects/ — contract, public-scope, and regression tests continue to reference the public exemplars in docs/_generated/active_projects.md.

Coverage Expectations

  • Infrastructure code is held to the repository coverage floor in tests/infra_tests/.
  • Integration tests should confirm the pipeline and shell entry points remain wired correctly.
  • The project pipeline uses a curated pipeline-smoke infrastructure subset for speed; the full infrastructure coverage gate remains explicit (scripts/pipeline/stage_01_test.py --infra-only --infra-scope full).

Documentation Expectations

  • Keep README.md files aligned with the live test tree.
  • Keep per-folder AGENTS.md files accurate and specific to the folder they document.

Multi-project pytest and conftest.py

Canonical: Run one pytest process per projects/<name>/tests/ tree. Use infrastructure.core.test_runner.run_per_project_pytest (from scripts/pipeline/stage_01_test.py), or invoke uv run pytest projects/<name>/tests/ for a single workspace. The local --project-only --all-projects orchestrator can merge coverage with --cov-append; CI test-project runs each public exemplar in its own matrix job.

Unsupported: One pytest collection that spans multiple projects/*/tests/ directories when more than one of them defines tests/conftest.py. Pytest loads each conftest as a plugin; the shared basename collides (ValueError: plugin already registered). The workaround is the per-project subprocess model above, not a single mega pytest command.

References: infrastructure/core/testing/test_runner.py, tests/infra_tests/core/test_test_runner_per_project.py, infrastructure/core/testing/project_test_matrix.py (bounded per-project subprocess matrix with duplicate-index rejection).

See Also

  • README.md
  • infra_tests/AGENTS.md
  • integration/AGENTS.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.