Python TDD

Python TDD

Write tests first. Covers pytest, unittest, mocking, fixtures, coverage, property-based testing, and TDD workflow in real projects.

FundamentalsTopics 1–9
  • ·pytest basics (install/discovery/run)
  • ·Writing your first test
  • ·Assertions & pytest output
  • ·Test fixtures (function/class/module scope)
  • ·pytest.mark (skip/xfail/parametrize)
  • ·unittest.TestCase basics
  • ·The TDD cycle in Python
  • ·Testing a simple function
  • ·Testing exceptions
Start Fundamentals
IntermediateTopics 10–18
  • ·Mocking with unittest.mock (MagicMock/patch)
  • ·Patching built-ins & imports
  • ·Fixtures for database setup (SQLite in-memory)
  • ·Testing Flask/FastAPI endpoints
  • ·Testing async code (pytest-asyncio)
  • ·conftest.py & shared fixtures
  • ·Coverage with pytest-cov
  • ·Custom pytest plugins
  • ·Testing CLI tools (Click/Typer)
Start Intermediate
AdvancedTopics 19–27
  • ·Property-based testing (Hypothesis)
  • ·Mutation testing (mutmut)
  • ·Integration testing with Docker (testcontainers-python)
  • ·Testing Celery tasks
  • ·Testing external APIs (responses/httpretty)
  • ·Benchmark testing (pytest-benchmark)
  • ·Snapshot testing
  • ·Parallel test execution (pytest-xdist)
  • ·CI integration for Python tests
Start Advanced
PatternsTopics 28–35
  • ·TDD workflow for a REST API
  • ·Repository pattern for testability
  • ·Dependency injection in Python
  • ·Fixture factories (factory_boy)
  • ·Test data management
  • ·Testing Django models & views
  • ·Refactoring legacy Python with tests
  • ·Testing strategy for ML code
Start Patterns