# FAQ

## How do I run pytest on multiple Python versions?

Add pytest-uv to your development dependencies and pass the versions:

```bash
uv add --dev pytest-uv
uv run pytest --python-versions 3.11,3.12,3.13
```

Each version gets its own environment and an xdist worker, and every test runs once per version. See the [Quickstart](<https://jirikuncar.github.io/pytest-uv/quickstart/index.md>).

## How do I test every version my project supports?

`uv run pytest --python-versions auto` tests each installed interpreter that satisfies `requires-python`. For a fixed list, put `versions` under `[tool.pytest-uv]` and use `--python-versions declared`. See [Choosing versions](<https://jirikuncar.github.io/pytest-uv/guide/versions/index.md>).

## Do I need to install the Python versions first?

Not for an explicit list or `declared`: uv downloads missing interpreters. `auto` only uses installed ones; install them with `uv python install 3.11 3.12 3.13`.

## Does it change my `.venv`?

No. The per-version environments live in `.pytest-uv/`. Your `.venv` is only where pytest itself (the controller) runs.

## Why is the first run slow, and later ones fast?

The first run builds an environment per version (in parallel, from uv's cache). Later runs reuse them until `pyproject.toml`, `uv.lock`, the version or the `[tool.pytest-uv]` arguments change. Your source is installed in editable mode, so code changes need no rebuild. See [Environments](<https://jirikuncar.github.io/pytest-uv/guide/environments/index.md>).

## Can I use `-n auto` to make it faster?

Not together with `--python-versions`: each version runs in exactly one worker, and `-n` is a usage error. The versions already run in parallel with each other. For a large suite on one version, run `pytest -n auto` without `--python-versions`.

## How do I debug a failure that happens on one version only?

Re-run on that version with `--python-versions 3.11 --lf`, or skip xdist and use the environment's interpreter for `--pdb`: `.pytest-uv/py3.11/bin/python -m pytest tests/test_x.py::test_y --pdb`. See [Debugging failures](<https://jirikuncar.github.io/pytest-uv/guide/debugging/index.md>).

## How do I skip a test on some versions?

Use `@pytest.mark.skipif(sys.version_info < (3, 12), reason=...)`; each worker evaluates it in its own interpreter. The `python_version` fixture tells a test which version it runs on. See [Version-specific tests](<https://jirikuncar.github.io/pytest-uv/guide/version-specific-tests/index.md>).

## Does it work without `uv.lock`?

Yes. Without a lock file, each environment is created with `uv venv` and filled with `uv pip install` and [`install-args`](<https://jirikuncar.github.io/pytest-uv/reference/configuration/index.md#install-args>).

## Does it work with pip, Poetry or Hatch projects?

The project needs a `pyproject.toml` that uv can install, which covers any standard build backend (Hatchling, setuptools, Poetry's `poetry-core`, ...). uv must be on `PATH`, but you don't have to manage the project with uv: without `uv.lock`, pytest-uv uses `uv pip install`.

## Does it support PyPy or free-threaded Python?

`auto` picks final releases of the default CPython build only. Name other builds explicitly: `--python-versions 3.13,3.14t` adds a free-threaded 3.14 worker. Each entry is passed to uv as a version request, so PyPy requests such as `pypy3.11` reach uv too, but pytest-uv's own tests cover CPython only.

## Does it work on Windows and macOS?

Linux and macOS are tested in CI. On Windows, environments use `Scripts\python.exe` instead of `bin/python`; report problems in [GitHub Issues](<https://github.com/jirikuncar/pytest-uv/issues>).

## Should I replace tox or nox with it?

If they only run pytest on several Python versions, pytest-uv does the same with less configuration. If they also lint, type-check, build docs or test against several dependency versions, keep them. See [Comparisons](<https://jirikuncar.github.io/pytest-uv/alternatives/index.md>).

## Where does the `python_version` fixture come from?

From pytest-uv. It returns the worker's version such as `"3.13"`, or `None` without `--python-versions`.

## Is it safe to run two pytest sessions at once?

Yes. Each environment is locked while it is built; a second session waits and then reuses it.
