Medium
Python
Use pytest for testing
Official
Rule Description
Use pytest as your testing framework:
- Simple assert statements
- Powerful fixtures for setup/teardown
- Parametrized tests for multiple inputs
- Rich plugin ecosystem
```python
import pytest
@pytest.fixture
def user():
return User(name="Test", email="[email protected]")
def test_user_full_name(user):
assert user.full_name == "Test"
@pytest.mark.parametrize("input,expected", [
(1, 1), (2, 4), (3, 9)
])
def test_square(input, expected):
assert square(input) == expected
```
Included in Rulesets
Django Best Practices
36 rules • 1 standard
FastAPI Guidelines
36 rules • 1 standard
Python Standards
33 rules • 2 standards
Minitest Testing
24 rules • 1 standard
RSpec Testing
24 rules • 0 standards
Jest Testing
24 rules • 2 standards
Pytest Testing
24 rules • 2 standards
Vitest Testing
24 rules • 3 standards
Mocha Testing
24 rules • 0 standards
Code Review Standards
58 rules • 0 standards
Add This Rule
Sign in to add this rule to your workspace
Sign in with GitHubDetails
- Severity
- Medium
- Category
- Python
- Used in
- 10 rulesets