(tests-intro)=
# Tests and data for your Python package
Adding tests to your package provides a set of checks that ensure that its
functioning how you expect it to.
In this section, you will learn about the importance of writing
tests for your Python package, different [types of tests that you should consider](test-types) and how you can set up infrastructure
to run your tests both [locally](run-tests) and [on GitHub](tests-ci).
:::::{grid} 1 1 3 2
:class-container: text-center
:gutter: 3
::::{grid-item-card} ✨ Why write tests ✨
:link: write-tests
:link-type: doc
:class-card: left-aligned
Learn about the importance of writing tests for your Python
package and how they help you and potential contributors.
::::
::::{grid-item-card} ✨ Types of tests ✨
:link: test-types
:link-type: doc
:class-card: left-aligned
Get to know the three test types: unit, integration, and
end-to-end tests. Learn when and how to use each.
::::
::::{grid-item-card} ✨ Run tests locally ✨
:link: run-tests
:link-type: doc
:class-card: left-aligned
Learn about testing tools like pytest, nox, and tox to run
tests across different Python versions on your computer. And explore examples of using Hatch with UV as a task runner to run tests across Python versions.
::::
::::{grid-item-card} ✨ Run tests locally (using nox) ✨
:link: run-tests-nox
:link-type: doc
:class-card: left-aligned
Nox is a python powered task runner that can be used to run tests. Learn how to use nox to run tests.
::::
::::{grid-item-card} ✨ Run tests online (using CI) ✨
:link: tests-ci
:link-type: doc
:class-card: left-aligned
Set up continuous integration with GitHub Actions to run
tests across Python versions and operating systems.
::::
::::{grid-item-card} ✨ Code coverage ✨
:link: code-cov
:link-type: doc
:class-card: left-aligned
Measure how much of your package code runs during tests.
Learn to generate local reports and visualize coverage online.
::::
:::::
:::{figure-md} fig-target
Graphic showing the elements of the packaging process.
:::
```{toctree}
:hidden:
:maxdepth: 2
:caption: Create & Run Tests
Intro
Write tests
Test types
Run tests locally
Run tests with Nox
Run tests online (using CI)
Code coverage
```
```{toctree}
:hidden:
:maxdepth: 2
:caption: Data for Your Package
Package Data
```