Skip to content

Commit a48bb09

Browse files
authored
Add more instructions to claude (#3992)
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>
1 parent 68c628b commit a48bb09

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Before writing ANY new code:
3939
- **NEVER use single-letter variable names** - ALWAYS use descriptive, meaningful names
4040
- **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).
4141
- **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
4244

4345
### Acceptable Defensive Checks (Exceptions Only)
4446

@@ -65,6 +67,7 @@ The "no defensive programming" rule has these five exceptions:
6567
- **Tests MUST be independent** - use `pytest-dependency` ONLY when test B requires side effects from test A (e.g., cluster-wide configuration).
6668
For resource dependencies, use shared fixtures instead. **When using `@pytest.mark.dependency`, a comment explaining WHY the dependency exists is REQUIRED.**
6769
- **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
6871

6972
**`__test__ = False` Usage Rules:**
7073

0 commit comments

Comments
 (0)