Skip to main content

19 docs tagged with "testing"

View all tags

Code Coverage - Measuring What You Test (and What You Miss)

Master code coverage at engineering depth - line vs branch vs condition coverage, coverage.py internals with sys.settrace, pytest-cov, .coveragerc configuration, pragma no cover, coverage in CI, and mutation testing with mutmut to find tests that pass but don't catch bugs.

Hexagonal Architecture

Ports and Adapters - structuring Python applications so business logic is independent of frameworks, databases, and external services.

Linting and Formatting - Ruff, Black, isort, and mypy

Master Python code quality tooling at engineering depth - Ruff's rule categories, Black's opinionated formatting, isort profiles, mypy static type checking, pyproject.toml configuration, and how to wire all tools into a coherent developer workflow.

Module 04 - Testing and Quality Overview

Build production-grade test suites at engineering depth - unittest, pytest, mocking, TDD, code coverage, linting, and pre-commit hooks that enforce quality at every commit.

Module 04 Projects - Testing and Quality

Overview of the two hands-on engineering projects for the Testing and Quality module - a full pytest suite for a banking system and a complete CI quality pipeline setup.

Pre-Commit Hooks - Automate Quality Gates Before Every Commit

Master the pre-commit framework at engineering depth - Git hook mechanics, .pre-commit-config.yaml structure, building production hook pipelines with ruff, black, mypy, detect-secrets, and pytest, CI integration, team adoption strategy, and hook performance tuning.

Project 01 - Full Test Suite for a Banking System

Build a production-quality pytest test suite for the BankAccount and SavingsAccount system - fixtures, parametrized edge cases, mocked external dependencies, integration tests, Hypothesis property-based tests, and 90% branch coverage enforcement.

Project 02 - CI Quality Pipeline Setup

Configure a complete Python quality pipeline from scratch - pre-commit hooks, pyproject.toml tool configuration, GitLab CI four-stage pipeline, tox/nox multi-version testing, Makefile targets, coverage gate, and JUnit test report artifacts.

pytest - The Industry-Standard Test Framework

Master pytest at full engineering depth - assertion rewriting via AST transformation, fixtures with scope, conftest.py, parametrize, monkeypatch, capsys, built-in marks, essential plugins, and pyproject.toml configuration for production test suites.

unittest - The Standard Library Test Framework

Master Python's unittest framework at engineering depth - TestCase lifecycle, all assertion methods, assertRaises as context manager, setUp/tearDown/setUpClass, unittest.mock.patch, TestSuite, skip decorators, and subtests for parametrised testing.