Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ parallelism details, see [Running DDTest](docs/running.md).
| --- | --- |
| `--platform` | Language/platform. Currently supported: `ruby`, `python`, `javascript`. |
| `--framework` | Test framework. Currently supported: `rspec`, `minitest`, `pytest`, `cucumber`, `cypress`, `jest`, `mocha`, `playwright`, `vitest`. |
| `--command` | Override the default base command for supported framework modes. Currently used by RSpec and Minitest run/discovery, and Cucumber, Cypress, Jest, Mocha, Playwright, and Vitest run/discovery. For pytest, use `PYTEST_ADDOPTS` for pytest flags. |
| `--command` | Override the default base command for supported framework modes. Used by RSpec and Minitest run/discovery, Cucumber, Cypress, Jest, Mocha, Playwright, and Vitest run/discovery, and pytest run/discovery (since 1.7.0). For ddtest versions prior to 1.7.0 with pytest, the command cannot be changed. Pass extra flags with `PYTEST_ADDOPTS`. |
| `--min-parallelism` | Minimum CI node or worker count DDTest considers when planning. |
| `--max-parallelism` | Maximum CI node or worker count DDTest considers when planning. |
| `--target-time` | Target wall time DDTest tries to satisfy when selecting parallelism. |
Expand Down
12 changes: 8 additions & 4 deletions docs/best_practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,14 @@ changes in sibling projects do not invalidate its discovery cache.

## Pytest Support

DDTest runs pytest as `python -m pytest` and appends the selected test files.
It also appends `--ddtrace` to `PYTEST_ADDOPTS`, preserving any existing
`PYTEST_ADDOPTS` value, so the `ddtrace` pytest plugin loads without changing
your pytest config.
DDTest runs pytest as `python -m pytest` by default and appends the selected
test files. Since 1.7.0, set `--command` to override the base command. For
example, `--command pytest` runs the `pytest` console script instead of
`python -m pytest`. DDTest runs `<command> <files>` and does not add
`-m pytest`. DDTest also appends `--ddtrace` to `PYTEST_ADDOPTS`, preserving
any existing `PYTEST_ADDOPTS` value, so the `ddtrace` pytest plugin loads
without changing your pytest config. To pass extra pytest flags without
changing the base command, use `PYTEST_ADDOPTS`.

For discovery, DDTest reads `testpaths` and `python_files` from `pytest.ini`,
`pyproject.toml`, `tox.ini`, or `setup.cfg`. If no pytest config defines those
Expand Down
18 changes: 12 additions & 6 deletions docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ starting each worker.
## Custom Commands

Use `--command` to override the framework's default base test command where
supported. DDTest currently applies this override to RSpec run and full
discovery, Minitest run and full discovery, and Cucumber, Cypress, Jest, Mocha,
Playwright, and Vitest run and file discovery:
supported. DDTest applies this override to RSpec run and full
discovery, Minitest run and full discovery, Cucumber, Cypress, Jest, Mocha,
Playwright, and Vitest run and file discovery, and pytest run and discovery
(since 1.7.0):

```bash
ddtest run --platform ruby --framework rspec --command "bundle exec rspec --profile"
Expand Down Expand Up @@ -228,8 +229,11 @@ ddtest run --command "bundle exec my-wrapper --"
If your command contains `--`, DDTest will emit a warning and automatically
remove the `--` separator and anything after it.

For pytest, use `PYTEST_ADDOPTS` for pytest flags. DDTest currently runs
`python -m pytest` and appends the selected test files. DDTest appends
For pytest, DDTest runs `python -m pytest <files>` by default. Since 1.7.0,
set `--command` to override the base command. For example, `--command pytest`
runs the `pytest` console script instead of `python -m pytest`. DDTest runs
`<command> <files>` and does not add `-m pytest`. To pass extra pytest flags
without changing the base command, use `PYTEST_ADDOPTS`. DDTest appends
`--ddtrace` to `PYTEST_ADDOPTS` so the `ddtrace` pytest plugin loads
automatically.

Expand All @@ -243,7 +247,9 @@ For Python/pytest, DDTest discovers test files using this priority:
3. The built-in pattern `**/{test_*,*_test}.py`.

Pytest does not have an equivalent to RSpec's pattern flag, so DDTest resolves
the pattern to explicit file paths before invoking `python -m pytest`.
the pattern to explicit file paths before invoking the configured pytest
command. The default is `python -m pytest`. Since 1.7.0, `--command` overrides
it.

## Jest Discovery And Instrumentation

Expand Down
2 changes: 1 addition & 1 deletion docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ CLI flags take precedence over environment variables.
| --- | --- | --- | ---: | --- |
| `--platform` | `DD_TEST_OPTIMIZATION_RUNNER_PLATFORM` | | `ruby` | Language/platform. Currently supported: `ruby`, `python`, `javascript`. |
| `--framework` | `DD_TEST_OPTIMIZATION_RUNNER_FRAMEWORK` | | `rspec` | Test framework. Currently supported: `rspec`, `minitest`, `pytest`, `cucumber`, `cypress`, `jest`, `mocha`, `playwright`, `vitest`. |
| `--command` | `DD_TEST_OPTIMIZATION_RUNNER_COMMAND` | | `""` | Override the default base test command for supported framework modes. Currently used by RSpec and Minitest run/discovery, and Cucumber, Cypress, Jest, Mocha, Playwright, and Vitest run/discovery; pytest ignores it. DDTest appends selected tests and framework-specific flags. For pytest, use `PYTEST_ADDOPTS` for pytest flags. |
| `--command` | `DD_TEST_OPTIMIZATION_RUNNER_COMMAND` | | `""` | Override the default base test command for supported framework modes. Used by RSpec and Minitest run/discovery, Cucumber, Cypress, Jest, Mocha, Playwright, and Vitest run/discovery, and pytest run/discovery (since 1.7.0). DDTest appends selected tests and framework-specific flags. For ddtest versions prior to 1.7.0 with pytest, the command cannot be changed. Pass extra flags with `PYTEST_ADDOPTS`. |
| `--min-parallelism` | `DD_TEST_OPTIMIZATION_RUNNER_MIN_PARALLELISM` | | physical CPU count | Minimum count DDTest considers when planning. Interpret it as CI nodes in CI-node mode, or workers in a single-node run. |
| `--max-parallelism` | `DD_TEST_OPTIMIZATION_RUNNER_MAX_PARALLELISM` | | physical CPU count | Maximum count DDTest considers when planning. Interpret it as CI nodes in CI-node mode, or workers in a single-node run. |
| `--ci-job-overhead` | `DD_TEST_OPTIMIZATION_RUNNER_CI_JOB_OVERHEAD` | | `25s` | Modeled overhead for adding one more CI node. Accepts durations such as `25s`, `1m`, `1500ms`, or `0s` to disable this bias. Increase it to use fewer CI nodes; decrease it to prefer faster wall time. |
Expand Down
Loading