codeflash/.claude/rules/testing.md
Kevin Turcios 0650973d8c refactor: restructure CLAUDE.md for effective context usage
- Remove commands block from CLAUDE.md (standard tool usage Claude knows)
- Remove dead @AGENTS.md reference
- Add optimization pipeline overview with module pointers
- Add domain glossary (optimization candidate, addressable time, candidate
  forest, replay test, tracer, worktree mode)
- Extract mypy workflow to .claude/skills/fix-mypy.md (on-demand)
- Create .claude/skills/fix-prek.md for prek workflow (on-demand)
- Add key entry points table to architecture.md
- Create path-scoped rules: optimization-patterns.md, language-patterns.md
- Remove redundancy from source-code.md and across rules files
- Move "never use pip" convention to code-style.md
2026-02-14 17:37:51 -05:00

1 KiB

paths
tests/**
codeflash/**/*test*.py

Testing Conventions

  • Code context extraction and replacement tests must always assert for full string equality, no substring matching.
  • Use pytest's tmp_path fixture for temp directories (it's a Path object).
  • Write temp files inside tmp_path, never use NamedTemporaryFile (causes Windows file contention).
  • Always call .resolve() on Path objects to ensure absolute paths and resolve symlinks.
  • Use .as_posix() when converting resolved paths to strings (normalizes to forward slashes).
  • Any new feature or bug fix that can be tested automatically must have test cases.
  • If changes affect existing test expectations, update the tests accordingly. Tests must always pass after changes.
  • The pytest plugin patches time, random, uuid, and datetime for deterministic test execution — never assume real randomness or real time in verification tests.
  • conftest.py uses an autouse fixture that calls reset_current_language() — tests always start with Python as the default language.