python-testing
SolidStub-Driven TDD and layer boundary testing with pytest. Use when writing tests, deciding what to test, testing at component boundaries, or implementing test-driven development.
Testing & QA 38 stars
3 forks Updated 5 days ago MIT
Install
Quality Score: 87/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Testing with pytest
Stub-Driven TDD and layer boundary testing patterns for Python applications.
## Core Principle: Stub-Driven TDD
Test at component boundaries, not internal implementation:
```
Router → Service → Repository → Entity → Database
↓ ↓ ↓ ↓
Test Test Test Test
```
Follow the **Stub → Test → Implement → Refactor** workflow:
1. **Stub** - Create function signature with `pass`
2. **Test** - Write test for expected behavior
3. **Implement** - Make test pass
4. **Refactor** - Clean up code
```python
# 1. Stub
def calculate_discount(total: Decimal) -> Decimal:
pass
# 2. Test
def test_discount_for_large_order():
result = calculate_discount(Decimal("150"))
assert result == Decimal("15")
# 3. Implement
def calculate_discount(total: Decimal) -> Decimal:
if total > 100:
return total * Decimal("0.1")
return Decimal("0")
```
## Layer Boundary Testing Overview
Test **what crosses layer boundaries**, not internal implementation:
- **Entity Layer**: Domain logic, validation, transformations (from_request, to_response, to_record)
- **Service Layer**: Business workflows, error handling, dependency orchestration
- **Repository Layer**: CRUD operations, query logic, entity ↔ record transformations
- **Router Layer**: Request validation, response serialization, status codes
See references/boundaries.md for comprehensive layer-specific examples.
## Entity Testing Example
Test transformations and ...
Details
- Author
- martinffx
- Repository
- martinffx/atelier
- Created
- 6 months ago
- Last Updated
- 5 days ago
- Language
- TypeScript
- License
- MIT
Integrates with
Bundled in these plugins
Similar Skills
Semantically similar based on skill content — not just same category
Testing & QA Solid
oracle-testing
Stub-Driven TDD and layer boundary testing. Use when writing tests, deciding what to test, or testing at component boundaries.
38 Updated 5 days ago
martinffx Testing & QA Listed
test-driven-development
Core TDD philosophy and testing principles. Use when writing tests interactively or need testing guidance. Emphasizes tests as contracts, mock boundaries not internals, and implementation fixes over test changes.
6 Updated yesterday
Pyroxin Testing & QA Listed
python-testing
Python testing strategies using pytest, TDD methodology, fixtures, mocking, parametrization, and coverage requirements.
1 Updated today
Izangi2714