diff --git a/README.md b/README.md index 94196ca..4114f67 100644 --- a/README.md +++ b/README.md @@ -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. | diff --git a/docs/best_practices.md b/docs/best_practices.md index 0bd0d15..9947699 100644 --- a/docs/best_practices.md +++ b/docs/best_practices.md @@ -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 ` ` 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 diff --git a/docs/running.md b/docs/running.md index d9dee4a..a961e43 100644 --- a/docs/running.md +++ b/docs/running.md @@ -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" @@ -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 ` 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 +` ` 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. @@ -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 diff --git a/docs/settings.md b/docs/settings.md index 9419962..a2c0c18 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -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. |