docs: reflect pytest --command support - #124
Merged
Merged
Conversation
gnufede
marked this pull request as ready for review
August 28, 2026 09:29
There was a problem hiding this comment.
More details
The changed documents match the pytest command override behavior. The review found no incorrect or conflicting guidance.
🤖 Datadog Autotest · Commit 226041c · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest
PR #123 made PyTest.RunTests and DiscoverTests honor commandOverride (set via --command / DD_TEST_OPTIMIZATION_RUNNER_COMMAND) instead of hardcoding 'python -m pytest'. Update settings, README, running, and best_practices docs to describe the override and retain PYTEST_ADDOPTS guidance for passing extra flags.
gnufede
force-pushed
the
gnufede/ddtest-docs-update
branch
from
August 28, 2026 09:44
226041c to
c6af345
Compare
juan-fernandez
approved these changes
Aug 28, 2026
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: c6af345 | Docs | View more details | Give us feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Documents that since release 1.7.0, Python/pytest honors
--command/DD_TEST_OPTIMIZATION_RUNNER_COMMANDto override the defaultpython -m pytestinvocation. PR #123 madePyTest.RunTestsandDiscoverTestsusecommandOverridewhenset, so callers can run the
pytestconsole script (or a wrapper) instead ofpython -m pytest. Previously the docs stated pytest ignored--command.Updates
docs/settings.md,docs/running.md,docs/best_practices.md, andREADME.mdto describe the override and retainPYTEST_ADDOPTSguidance for passing extra pytest flags.Why
python -m pytestsetssys.argv[0]to pytest's__main__.py, which ddtrace'sdetect_serviceincorrectly treats as a test file path, yieldingservice='pytest'instead of the module name. Thepytestconsole script setsargv[0]='pytest', whichdetect_serviceskips, so service inference is correct. With this change, projects setDD_TEST_OPTIMIZATION_RUNNER_COMMAND=pytestand ddtest runspytest <files>.The docs previously claimed pytest ignored
--commandand thatPYTEST_ADDOPTSwas the only way to customize the pytest invocation, which is no longer accurate.Testing
Tested internally in dd-trace-py CI