Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b581cad

Browse filesBrowse files
committed
cursor,windsurf(rules): Add pytest testing guidelines to project rules
why: Standardize pytest testing practices across the project. what: - Add section specifying use of fixtures over mocks - Example: libtmux-specific fixtures (server, session, window, pane) - Require documentation for exceptional test cases - Recommend tmp_path fixture over tempfile - Prefer monkeypatch fixture over unittest.mock refs: Improves consistency and maintainability of test suite
1 parent 9a0baba commit b581cad
Copy full SHA for b581cad

File tree

Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+19
-0
lines changed

‎.cursor/rules/dev-loop.mdc

Copy file name to clipboardExpand all lines: .cursor/rules/dev-loop.mdc
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,14 @@ For doctests in `src/**/*.py` files:
156156
# Watch specific modules for doctest changes
157157
uv run ptw . --now --doctest-modules src/path/to/module.py
158158
```
159+
160+
### Pytest Testing Guidelines
161+
162+
1. **Use existing fixtures over mocks**:
163+
- Use fixtures from conftest.py instead of `monkeypatch` and `MagicMock` when available
164+
- For instance, if using libtmux, use provided fixtures: `server`, `session`, `window`, and `pane`
165+
- Document in test docstrings why standard fixtures weren't used for exceptional cases
166+
167+
2. **Preferred pytest patterns**:
168+
- Use `tmp_path` (pathlib.Path) fixture over Python's `tempfile`
169+
- Use `monkeypatch` fixture over `unittest.mock`

‎.windsurfrules

Copy file name to clipboardExpand all lines: .windsurfrules
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,11 @@
111111
- Separate subject from body with a blank line
112112
- Mark breaking changes clearly: `BREAKING:`
113113
</git_commit_standards>
114+
115+
<pytest_testing_guidelines>
116+
- Use fixtures from conftest.py instead of monkeypatch and MagicMock when available
117+
- For instance, if using libtmux, use provided fixtures: server, session, window, and pane
118+
- Document in test docstrings why standard fixtures weren't used for exceptional cases
119+
- Use tmp_path (pathlib.Path) fixture over Python's tempfile
120+
- Use monkeypatch fixture over unittest.mock
121+
</pytest_testing_guidelines>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.