docs: add TESTING.md for python#2961
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Assessment: Approve Documentation-only change that adds an authoritative Python Verification details
Only one non-blocking clarity nit inline (the two assertion rules can read as contradictory). Clear, accurate, and tightly scoped — nice work splitting the |
|
Assessment: Approve Re-reviewed after the "Clarify wording" commit ( No other changes since the last pass; the TS path correction is unchanged and still accurate. Nothing outstanding — good to merge. |
|
Assessment: Approve Re-reviewed after the "Address comments" commit ( How each comment was addressed
One thing worth confirming with the reviewer: this Python doc intentionally keeps Nothing blocking. Accurate, tightly scoped, and all reviewer feedback addressed. |
Description
The TypeScript SDK has a thorough
docs/TESTING.mdthatstrands-ts/AGENTS.mdhard-delegates to ("you MUST follow"). The Python SDK had no equivalent — its testing guidance was ~40 lines insideAGENTS.mdand nothing indocs/. The practical cost is that real, reusable test infrastructure stays invisible: the shared fixtures (MockedModelProvider,MockHookProvider,MockAgentTool,MockedSessionRepository) and theconftest.pyasync/AWS helpers (agenerator,alist,generate,moto_*) aren't documented anywhere, so contributors hand-roll their own mocks instead of reusing them. A few sharp edges also went unwritten — strict-asyncio mode silently skips an unmarked coroutine test, and asserting a wholeMessagedict when a test only cares about role/text is a recurring source of brittle breakage intests_integ/.This adds
strands-py/docs/TESTING.mdas the authoritative Python testing reference, mirroring the TypeScript guide's depth and topic coverage so the two SDKs stay aligned. It documents the fixtures quick-reference (with "reuse these, don't hand-roll"), thetru_/exp_assertion-pair naming, whole-object assertions withunittest.mock.ANYfor volatile fields, the strict-asyncio marker requirement, and the flat-vs-class test-organization preference — all reflecting conventions the suite already follows rather than inventing new ones.It also corrects a contradiction in
strands-ts/docs/TESTING.md, which referenced atests_integ/directory that doesn't exist; the integration tests live intest/integ/(as the same file states a few lines later). An agent following the authoritative doc would otherwise create files in the wrong place.The companion
AGENTS.mdrestructure that links to this new file is a separate PR; this one is split out so the doc it points at lands first.Related Issues
None — maintenance change surfaced by a convention audit of both SDKs.
Documentation PR
Not applicable — these are contributor-facing
docs/files in the SDK packages, not user-facing documentation undersite/.Type of Change
Documentation update
Testing
Documentation-only. Verified that every fixture, helper, and path named in the new guide exists in the tree (
tests/fixtures/*, theconftest.pysession-scoped helpers, strict-asyncio being the default), and that the correctedtest/integ/path matches the real TypeScript integration-test directory.hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.