Skip to main content
Version: 2.12 (deprecated)

test


pants test [args]

Run tests.

Backend: pants.core

Config section: [test]

Basic options

debug

--[no-]test-debug
PANTS_TEST_DEBUG
pants.toml
[test]
debug = <bool>
default: False

Run tests sequentially in an interactive process. This is necessary, for example, when you add breakpoints to your code.

extra_env_vars

--test-extra-env-vars="['<str>', '<str>', ...]"
PANTS_TEST_EXTRA_ENV_VARS
pants.toml
[test]
extra_env_vars = [
'<str>',
'<str>',
...,
]
default: []

Additional environment variables to include in test processes. Entries are strings in the form ENV_VAR=value to use explicitly; or just ENV_VAR to copy the value of a variable in Pants's own environment.

force

--[no-]test-force
PANTS_TEST_FORCE
pants.toml
[test]
force = <bool>
default: False

Force the tests to run, even if they could be satisfied from cache.

open_coverage

--[no-]test-open-coverage
PANTS_TEST_OPEN_COVERAGE
pants.toml
[test]
open_coverage = <bool>
default: False

If a coverage report file is generated, open it on the local system if the system supports this.

output

--test-output=<ShowOutput>
PANTS_TEST_OUTPUT
pants.toml
[test]
output = <ShowOutput>
one of: all, failed, none
default: failed

Show stdout/stderr for these tests.

use_coverage

--[no-]test-use-coverage
PANTS_TEST_USE_COVERAGE
pants.toml
[test]
use_coverage = <bool>
default: False

Generate a coverage report if the test runner supports it.

Advanced options

report

--[no-]test-report
PANTS_TEST_REPORT
pants.toml
[test]
report = <bool>
default: False

Write test reports to --report-dir.

report_dir

--test-report-dir=<str>
PANTS_TEST_REPORT_DIR
pants.toml
[test]
report_dir = <str>
default: {distdir}/test/reports

Path to write test reports to. Must be relative to the build root.

Deprecated options

xml_dir

--test-xml-dir=<DIR>
PANTS_TEST_XML_DIR
pants.toml
[test]
xml_dir = <DIR>
default: None
Deprecated, will be removed in version: 2.13.0.dev0.
Set the `report` option in [test] scope to emit reports to a standard location under dist/. Set the `report-dir` option to customize that location.

Specifying a directory causes Junit XML result files to be emitted under that dir for each test run that supports producing them.

None