You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add instructions to claude due to repetitive errors: Avoid programmatic
skips, imports always at the top of the module, and keep conftest.py for
fixtures
Signed-off-by: Asia Khromov <azhivovk@redhat.com>
Copy file name to clipboardExpand all lines: CLAUDE.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,8 @@ Before writing ANY new code:
39
39
-**NEVER use single-letter variable names** - ALWAYS use descriptive, meaningful names
40
40
-**No dead code** - every function, variable, fixture MUST be used or removed. Code marked with `# skip-unused-code` is excluded from dead code analysis (enforced via custom ruff plugin).
41
41
-**Prefer direct attribute access** - use `foo.attr` directly. Save to variables only when: reusing the same attribute multiple times improves readability, or extracting clarifies intent.
42
+
-**Imports always at the top of the module** - do not import inside functions
43
+
-**`conftest.py` is for fixtures only** - helper functions, utility functions, and classes must NOT be defined in conftest.py or test_*.py; place them in dedicated utility modules instead
42
44
43
45
### Acceptable Defensive Checks (Exceptions Only)
44
46
@@ -65,6 +67,7 @@ The "no defensive programming" rule has these five exceptions:
65
67
-**Tests MUST be independent** - use `pytest-dependency` ONLY when test B requires side effects from test A (e.g., cluster-wide configuration).
66
68
For resource dependencies, use shared fixtures instead. **When using `@pytest.mark.dependency`, a comment explaining WHY the dependency exists is REQUIRED.**
67
69
-**ALWAYS use `@pytest.mark.usefixtures`** - REQUIRED when fixture return value is not used by test
70
+
-**Do not offer to use `pytest.skip()` or `@pytest.mark.skip` or `@pytest.mark.skipif`** - pytest skip and skipif options are forbidden
0 commit comments