---
source: https://iinventedlight.com/library/notes/tox-environments.md
title: "tox run -e starts one or more isolated test environments, and -f selects by factor"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (tox docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: tox-dev/tox (GitHub), tox how-to: usage, MIT (https://raw.githubusercontent.com/tox-dev/tox/main/LICENSE); tox (tox.wiki), tox how-to: usage (website), MIT (https://raw.githubusercontent.com/tox-dev/tox/main/LICENSE)."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: tox environments"
tags: [tox, testing, environments, packaging, isolated]
client: Librarian
sources:
  - id: S1
    title: "tox how-to: usage"
    publisher: tox-dev/tox (GitHub)
    url: https://github.com/tox-dev/tox/blob/main/docs/how-to/usage.rst
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "tox how-to: usage (website)"
    publisher: tox (tox.wiki)
    url: https://tox.wiki/en/latest/how-to/usage.html
    accessed: 2026-11-18
    license: "MIT"
---
# tox run -e starts one or more isolated test environments, and -f selects by factor
**Answer:** tox runs commands in named, isolated environments. `tox run -e 3.13` runs one environment. `tox run -e lint,3.13` runs several in order. `tox run -f django` runs every environment whose name contains the `django` factor. `tox run -m test` runs every environment with that label.

## Selecting environments

Add `-r` to force recreation of the environment.

## Why isolation matters

Each environment has its own install of the project and its test dependencies, so one Python version or extra set does not leak into another.

## Claims

- id: C1
  claim: tox run -e starts a specific environment.
  source: S1
  evidence: "Run a specific environment: ``tox run -e 3.13``"

- id: C2
  claim: A factor selects every matching environment.
  source: S1
  evidence: "Run all environments matching a factor"

- id: C3
  claim: The published how-to documents the same tox run -e form.
  source: S2
  evidence: "tox run -e 3.13"

- id: C4
  claim: The published how-to also documents factor selection.
  source: S2
  evidence: "matching a factor"

## Sources

- [S1] tox how-to: usage. tox-dev/tox (GitHub). https://github.com/tox-dev/tox/blob/main/docs/how-to/usage.rst . License: MIT. Accessed 2026-11-18.

- [S2] tox how-to: usage (website). tox (tox.wiki). https://tox.wiki/en/latest/how-to/usage.html . License: MIT. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: tox-dev/tox (GitHub), tox how-to: usage, MIT (https://raw.githubusercontent.com/tox-dev/tox/main/LICENSE); tox (tox.wiki), tox how-to: usage (website), MIT (https://raw.githubusercontent.com/tox-dev/tox/main/LICENSE). Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
