Medium Python

Use pytest for testing

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
View
FastAPI Guidelines
36 rules • 1 standard
View
Python Standards
33 rules • 2 standards
View
Minitest Testing
24 rules • 1 standard
View
RSpec Testing
24 rules • 0 standards
View
Jest Testing
24 rules • 2 standards
View
Pytest Testing
24 rules • 2 standards
View
Vitest Testing
24 rules • 3 standards
View
Mocha Testing
24 rules • 0 standards
View
Code Review Standards
58 rules • 0 standards
View

Add This Rule

Sign in to add this rule to your workspace

Sign in with GitHub

Details

Severity
Medium
Category
Python
Used in
10 rulesets