Pants v2: Fast, consistent builds for Python and more

Welcome to the Pants v2 documentation hub!

Pants v2 is a fast, scalable build system for growing codebases. It's currently focused on Python, with support for other languages coming soon.

Here you'll find guides to help you get started with Pants v2, comprehensive documentation on how to configure, run and customize Pants v2, and information on how to get help from the Pants community.

Get Started

The pytest Python test framework (https://docs.pytest.org/).

Config section: [pytest]

Basic options

--pytest-args="[<shell_str>, <shell_str>, ...]", ... -- [<shell_str> [<shell_str> [...]]]
PANTS_PYTEST_ARGS
args
default: []
Arguments to pass directly to Pytest, e.g. `--pytest-args="-k test_foo --quiet"`

--[no-]pytest-timeouts
PANTS_PYTEST_TIMEOUTS
timeouts
default: True
Enable test target timeouts. If timeouts are enabled then test targets with a timeout= parameter set on their target will time out after the given number of seconds if not completed. If no timeout is set, then either the default timeout is used or no timeout is configured.

Advanced options

--pytest-version=<str>
PANTS_PYTEST_VERSION
version
default: pytest>=6.0.1,<6.1
Requirement string for Pytest.

--pytest-pytest-plugins="['<str>', '<str>', ...]"
PANTS_PYTEST_PYTEST_PLUGINS
pytest_plugins
default:
[
  "pytest-cov>=2.10.1,<2.11",
  "zipp==2.1.0"
]

Requirement strings for any plugins or additional requirements you'd like to use.

--pytest-timeout-default=<int>
PANTS_PYTEST_TIMEOUT_DEFAULT
timeout_default
default: None
The default timeout (in seconds) for a test target if the timeout field is not set on the target.

--pytest-timeout-maximum=<int>
PANTS_PYTEST_TIMEOUT_MAXIMUM
timeout_maximum
default: None
The maximum timeout (in seconds) that can be set on a test target.

--pytest-junit-xml-dir=<DIR>
PANTS_PYTEST_JUNIT_XML_DIR
junit_xml_dir
default: None
Specifying a directory causes Junit XML result files to be emitted under that dir for each test run.

--pytest-junit-family=<str>
PANTS_PYTEST_JUNIT_FAMILY
junit_family
default: xunit2
The format of the generated XML file. See https://docs.pytest.org/en/latest/reference.html#confval-junit_family.

--pytest-execution-slot-var=<str>
PANTS_PYTEST_EXECUTION_SLOT_VAR
execution_slot_var
default: None
If a non-empty string, the process execution slot id (an integer) will be exposed to tests under this environment variable name.

Deprecated options

None

Updated about a month ago


pytest


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.