Testing and Continuous Integration (Learning Path) – Real Python

Learning PathSkills: Unit Testing, Doctest, Mock Object Library, Pytest, Continuous Integration, Docker, Code Quality, GitHub Actions, Software Testing, CI/CD

A person in a white coat with big glasses holding a computer next to a machine that shows big signs reading fail and pass

You’ll start with testing fundamentals using unittest and doctest, then explore Python’s mock object library and pytest. From there, you’ll learn about code quality best practices and tools before setting up continuous integration pipelines with GitHub Actions and Docker.

Testing and Continuous Integration

Learning Path ⋅ 9 Resources

Testing Fundamentals

Get an overview of testing in Python. You’ll learn the basics of test-driven development and how to use unittest and doctest to write and organize your tests.

Title image for Test-Driven Development With pytest (Getting Started With Testing in Python)

Course

Test-Driven Development With pytest

In this hands-on course, you’ll see how to create Python unit tests, execute them, and find the bugs before your users do. You’ll learn about the tools available to write and execute tests, check your application’s performance, and even look for security issues.

Title image for Getting Started With Testing in Python (Getting Started With Testing in Python)

Title image for Testing Your Python Code Base: Unit vs. Integration (Real Python Podcast E237 Title Image)

Title image for Python's doctest: Document and Test Your Code at Once (Python's doctest: Document and Test Your Code at Once)

Tutorial

Python's doctest: Document and Test Your Code at Once

Learn how to add usage examples to your code's documentation and docstrings and how to use these examples to test your code. To run your usage examples as automated tests, you'll use Python's doctest module from the standard library.

Title image for Python's unittest: Writing Unit Tests for Your Code (Python's unittest: Writing Unit Tests for Your Code)

Title image for Python's unittest: Writing Unit Tests for Your Code (Python's unittest: Writing Unit Tests for Your Code)

Mock Objects and pytest

Learn how to use Python’s mock object library to isolate your code during testing. Then explore pytest, a popular testing framework that simplifies writing and running tests.

Title image for Improving Your Tests With the Python Mock Object Library (Improving Your Tests With the Python Mock Object Library)

Title image for Understanding the Python Mock Object Library (Understanding the Python Mock Object Library)

Title image for Overcoming Testing Obstacles With Python's Mock Object Library (Real Python Podcast E286 Title Image)

Title image for Testing Your Code With pytest (Effective Python Testing With Pytest)

Course

Testing Your Code With pytest

Learn how to take your testing to the next level with pytest. You'll cover intermediate and advanced pytest features such as fixtures, marks, parameters, and plugins. With pytest, you can make your test suites fast, effective, and less painful to maintain.

Title image for Effective Testing with Pytest (Effective Python Testing With Pytest)

Code Quality

Writing tests is just one part of maintaining a healthy codebase. Learn about tools and best practices for measuring and improving your Python code quality.

Title image for Python Code Quality: Best Practices and Tools (Python Code Quality Illustration)

Tutorial

Python Code Quality: Best Practices and Tools

Learn about code quality and the key factors that make Python code high-quality. You'll explore effective strategies, powerful tools, and best practices to elevate your code to the next level.

Title image for Python Code Quality: Best Practices and Tools (Python Code Quality Illustration)

Title image for Measuring Python Code Quality, Simplicity, and Maintainability (Real Python Podcast Episode #117 Title Artwork)

Continuous Integration

Put your testing skills into practice by setting up automated pipelines. You’ll learn how to configure continuous integration with GitHub Actions and Docker.

Title image for Continuous Integration With Python (Continuous Integration with Python: An Introduction)

Course

Continuous Integration With Python

Learn the core concepts behind Continuous Integration (CI) and why they are essential for modern software engineering teams. Find out how to how set up Continuous Integration for your Python project to automatically create environments, install dependencies, and run tests.

Title image for Start Using a Build System & Continuous Integration in Python (Real Python Podcast Episode #137 Title Artwork)

Title image for Python Continuous Integration and Deployment Using GitHub Actions (Continuous Integration and Deployment for Python With GitHub Actions)

Title image for GitHub Actions for Python (Continuous Integration and Deployment for Python With GitHub Actions)

Title image for Build Robust Continuous Integration With Docker and Friends (Build Robust Continuous Integration With Docker and Friends)

Tutorial

Build Robust Continuous Integration With Docker and Friends

In this tutorial, you'll use Docker and GitHub Actions to build a robust continuous integration pipeline for a multi-container web application consisting of Flask and Redis. Along the way, you'll learn how to dockerize a Python web application.

Congratulations on completing this learning path! You’ve learned how to test Python code with unittest, doctest, pytest, and mock objects, and how to set up continuous integration pipelines.

You’ve also completed the Python Core Intermediate section. Nice work! Your next step is the advanced level:

Learning Path

Concurrency and Async Programming

9 Resources ⋅ Skills: Python, Concurrency, Async IO, Global Interpreter Lock, Thread Safety, Parallel Processing, Performance Optimization, Multithreading, Code Efficiency

You might also be interested in these related learning paths:

Got feedback on this learning path?

« Browse All Learning Paths