-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtesting.mdc
More file actions
38 lines (30 loc) · 830 Bytes
/
testing.mdc
File metadata and controls
38 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
type: auto-attached
pattern: "**/*test*.py"
---
# Testing Guidelines
## Test Structure
- Unit tests in `tests/unit/`
- Integration tests in `tests/integration/`
- Use pytest fixtures for setup
- Mark tests: `@pytest.mark.unit` or `@pytest.mark.integration`
## Coverage Requirements
- Minimum 80% coverage
- Run with: `task test`
- View report: `open htmlcov/index.html`
## Test Patterns
```python
import pytest
from {{ cookiecutter.project_slug }}.module import function
def test_function_success():
"""Test successful case."""
result = function(valid_input)
assert result == expected
def test_function_error():
"""Test error handling."""
with pytest.raises(SpecificError):
function(invalid_input)
@pytest.fixture
def sample_data():
"""Provide test data."""
return {"key": "value"}
```