Skip to content

Commit 5e08de1

Browse files
Add test placement guidance to usethis-python-test skill (#1898)
* Initial plan * Update usethis-python-test skill with test placement guidance (v1.3 → v1.4) Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/c190dab3-7bae-474b-8b73-f1f67ec0ea5b Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
1 parent 466b9b7 commit 5e08de1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • .agents/skills/usethis-python-test

.agents/skills/usethis-python-test/SKILL.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: General guidelines for writing tests in the usethis project, includ
44
compatibility: usethis, Python, pytest
55
license: MIT
66
metadata:
7-
version: "1.3"
7+
version: "1.4"
88
---
99

1010
# Python Test Guidelines
@@ -49,6 +49,14 @@ Nesting can go two or three levels deep when the logical structure demands it. F
4949

5050
Use the minimum depth needed to clearly communicate the test's context. Avoid nesting beyond three levels.
5151

52+
### Test file placement mirrors source file structure
53+
54+
Tests for a class method must live in the test file that corresponds to the source file where the class is defined — not in a test file for a utility that the method happens to call internally.
55+
56+
If a method is defined on `SomeClass` in `some_module.py`, its tests belong under `TestSomeClass` in `test_some_module.py`, regardless of which helper utilities the method uses at runtime.
57+
58+
Placing tests near the utility they exercise (rather than near the class they belong to) breaks the structural correspondence between source and test files, making tests harder to find and maintain.
59+
5260
### No docstrings on test classes or functions
5361

5462
Test classes and test functions should not have docstrings. The class and function names should be descriptive enough to communicate what is being tested.

0 commit comments

Comments
 (0)