Tests and data for your Python package#

Tests are an important part of your Python package because they provide a set of checks that ensure that your package is functioning how you expect it to.

In this section, you will learn more about the importance of writing tests for your Python package and how you can set up infrastructure to run your tests both locally and on GitHub.

✨ Why write tests ✨

Learn more about the art of writing tests for your Python package. Learn about why you should write tests and how they can help you and potential contributors to your project.

Write tests for your Python package
✨ Types of tests ✨

There are three general types of tests that you can write for your Python package: unit tests, integration tests and end-to-end (or functional) tests. Learn about all three.

Test Types for Python packages
✨ Run tests locally ✨

If you expect your users to use your package across different versions of Python, then using an automation tool such as nox to run your tests is useful. Learn about the various tools that you can use to run your tests across python versions here.

Run Python package tests
✨ Run tests online (using CI) ✨

Continuous integration platforms such as GitHub Actions can be useful for running your tests across both different Python versions and different operating systems. Learn about setting up tests to run in Continuous Integration here.

Run tests with Continuous Integration

Graphic showing the elements of the packaging process.#