Test Your Python Apps

Learning PathSkills: Testing Python Code, PyTest, Mocking

Python Testing

No developer is perfect, we all make mistakes and if left unchecked, some of these mistakes can lead to failures or bugs that can be very expensive to recover from.

Testing your code helps to catch these mistakes or avoid getting them into production in the first place. Testing therefore is very important in software development. Used effectively, tests help to identify bugs, ensure the quality of the product and to verify that the software does what it is meant to do.

With this learning path you’ll learn how to effectively test your Python code using modern tools and current best-practices.

Additional Resources

Test Your Python Apps

Learning Path ⋅ 6 Resources

Getting Started With Testing in Python


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.

Effective Python Testing With Pytest


Effective Python Testing 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.

Testing Python Command-Line Apps


4 Techniques for Testing Python Command-Line (CLI) Apps

Learn 4 essential testing techniques for Python command-line applications: "lo-fi" print debugging, using a visual debugger, unit testing with pytest and mocks, and integration testing.

Python Development Tools Artwork


Python Debugging With pdb

Learn the basics of using pdb, Python's interactive source code debugger. pdb is a great tool for tracking down hard-to-find bugs, and it allows you to fix faulty code more quickly.

Continuous Integration with Python: An Introduction


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.

Understanding the Python Mock Object Library


Improve Your Tests With the Python Mock Object Library

Learn how to use the Python mock object library, unittest.mock, to create and use mock objects to improve your tests. Obstacles like complex logic and unpredictable dependencies make writing valuable tests difficult, but unittest.mock can help you overcome these obstacles.

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