How to Run Tests Using uv
This guide shows you how to use uv to run tests in your Python projects efficiently.
Note
While this guide focuses on pytest, pytest can discover and run tests written for various Python testing frameworks, including unittest, nose, and doctest.
Prerequisites
- uv installed on your system
- A Python project with test files
Running Tests in an Existing Project
Basic Test Execution
If your project already has pytest configured as a dependency, run your tests with:
uv run pytest
Running Tests Without Adding pytest as a Dependency
For quick testing without modifying your project dependencies:
uv run --with pytest pytest
Learn More
- Setting up testing with pytest and uv for a complete testing setup
Last updated on