Testing and Continuous Integration

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 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)

Tutorial

Python's unittest: Writing Unit Tests for Your Code

Learn how to use the unittest framework to create unit tests for your Python code. Along the way, you'll also learn how to create test cases, fixtures, test suites, and more.

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)

Course

Improving Your Tests With the Python Mock Object Library

Master Python testing with unittest.mock. Create mock objects to tame complex logic and unpredictable dependencies.

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.

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.

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 Python Continuous Integration and Deployment Using GitHub Actions (Continuous Integration and Deployment for Python With GitHub Actions)

Course

Python Continuous Integration and Deployment Using GitHub Actions

Agile methodologies rely on robust DevOps systems to manage and automate common tasks in a continually changing codebase. GitHub Actions can help.

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

Interactive Quiz

GitHub Actions for Python

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?

Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

« Browse All Learning Paths