Book Description

Getting started with testing can be hard, and this book aims make it all very easy by using examples and explaining the process in a straightforward way. Testing is a core principle of robust software implementations and should be a prime skill to master that can be applied to any project.

Table of Contents

  1. Introduction
    1. Why test at all?
    2. Leveling up from simple scripts to robust implementations
    3. Python, Pytest, Tox supported versions in this book
    4. About the cover
  2. Chapter 1: Configuring the environment
    1. Setting up and using Git
    2. Setting up and using Virtualenv
    3. Installing packages and dependencies
    4. Setup Visual Code code
    5. Setup and use Vim
    6. Setup Makefile
    7. Setup and Use ZSH/Bash
    8. Using Cloud-based development environments
  3. Chapter 2: Testing Conventions
    1. Directories
    2. Files
    3. Functions, Classes, and test methods
    4. Special test class methods
    5. Good naming patterns
  4. Chapter 3: Introduction to Pytest
    1. The most simple test possible
    2. Why is Pytest important?
    3. The power of assert
    4. Pytest vs. Unittest
  5. Chapter 4: Test Classes
    1. Setting up and teardown of xunit-style tests
  6. Chapter 5: Reporting
    1. PyTest Reporting
    2. Code Quality
    3. Linting
    4. Code Formatting with Python Black
  7. Chapter 6: Debugging with Pytest
    1. How to debug code
    2. Using a debugger
    3. Python Debugger (PDB) integration
  8. Chapter 7: Pytest fixtures and plugins
    1. What are fixtures?
    2. Creating new fixtures
    3. Built-in Fixtures
    4. Advanced Fixture usage
    5. Parametrizing
  9. Chapter 8: Monkeypatching
    1. Why and when to monkeypatch?
    2. monkeypatching is hard
    3. The simplest monkeypatching
    4. Automatic and global monkeypatching
    5. Other patching
    6. When not to monkeypatch
  10. Chapter 9: Testing matrix with Tox
    1. Testing different Python versions
    2. Expanding the testing matrix
    3. Linting and other validations
  11. Chapter 10: Continuous Integration and Continuous Delivery
    1. What is Continuous Integration and Continuous Delivery and Why Do They Matter?
    2. Jenkins
    3. CircleCI
    4. GCP Cloud Build
    5. Continuous Delivery for Hugo Static Site from Zero using AWS Code Pipeline
    6. Github Actions
  12. Chapter 11: Case Studies and War Stories
    1. Testing Click Commandline Tools
    2. War Story: The Health Check that wasn’t wrong
    3. War Story: The Nine Circles of Hell While Parsing XML
    4. War Story: The Mysterious Vanishing Servers
  13. Chapter 12: Essays
    1. Writing clean, testable, high quality code in Python
    2. Increase reliability in data science and machine learning projects with CircleCI
    3. Data science project quality