From e227854d2273a5c91e74c8b6feb52d393d70e199 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 5 Dec 2025 14:06:45 +0100 Subject: [PATCH 1/3] chore(tools): allow args to be passed to riot directly --- scripts/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/run-tests b/scripts/run-tests index c3a551cd9af..da864238f2a 100755 --- a/scripts/run-tests +++ b/scripts/run-tests @@ -523,7 +523,7 @@ class TestRunner: # Add riot args if provided if riot_args: - cmd.extend(["--"] + riot_args) + cmd.extend(riot_args) if dry_run: print(f"[DRY RUN] Would execute: {' '.join(cmd)}") From 2ed4151fb651805caa78f2f15c87e0c6d5cc78f3 Mon Sep 17 00:00:00 2001 From: Christophe Papazian Date: Fri, 5 Dec 2025 15:33:56 +0100 Subject: [PATCH 2/3] update docs --- .claude/skills/run-tests/SKILL.md | 10 +++++----- docs/contributing-testing.rst | 9 +++++++-- scripts/run-tests | 8 +++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.claude/skills/run-tests/SKILL.md b/.claude/skills/run-tests/SKILL.md index 3a818fe0f1c..e8d43f4b234 100644 --- a/.claude/skills/run-tests/SKILL.md +++ b/.claude/skills/run-tests/SKILL.md @@ -84,7 +84,7 @@ When you modify files like: #### For Test-Only Changes When you modify `tests/` files (but not test infrastructure): - Run only the specific test files/functions modified -- Use pytest args: `-- -k test_name` or direct test file paths +- Use pytest args: `-- -- -k test_name` or direct test file paths #### For Test Infrastructure Changes When you modify: @@ -121,7 +121,7 @@ This will: For re-running specific tests: ```bash -scripts/run-tests --venv -- -vv -k test_name +scripts/run-tests --venv -- -- -vv -k test_name ``` ## When Tests Fail @@ -243,7 +243,7 @@ scripts/run-tests --list tests/contrib/flask/test_views.py # Output shows: contrib::flask suite # Run just the specific test: -scripts/run-tests --venv flask_py311 -- -vv tests/contrib/flask/test_views.py +scripts/run-tests --venv flask_py311 -- -- -vv tests/contrib/flask/test_views.py ``` ### Example 4: Iterating on a Failing Test @@ -251,7 +251,7 @@ scripts/run-tests --venv flask_py311 -- -vv tests/contrib/flask/test_views.py First run shows one test failing: ```bash -scripts/run-tests --venv flask_py311 -- -vv -k test_view_called_twice +scripts/run-tests --venv flask_py311 -- -- -vv -k test_view_called_twice # Focused on the specific failing test with verbose output ``` @@ -330,7 +330,7 @@ The `scripts/run-tests` system: - Uses `riot` to manage multiple Python/package combinations as venvs - Each venv is a self-contained environment - Docker services are managed per suite lifecycle -- Tests can pass optional pytest arguments with `--` +- Tests can pass optional pytest arguments with `-- --` ### Supported Suite Types diff --git a/docs/contributing-testing.rst b/docs/contributing-testing.rst index 952dac6fc31..8fad252557d 100644 --- a/docs/contributing-testing.rst +++ b/docs/contributing-testing.rst @@ -81,9 +81,14 @@ The ``scripts/run-tests`` script handles this automatically: .. code-block:: bash + # Add riot arguments for avoid unnecessary compilation + $ scripts/run-tests tests/contrib/django/ -- -s + # Add pytest arguments for test selection - $ scripts/run-tests tests/contrib/django/ -- -k test_specific_function - $ scripts/run-tests ddtrace/contrib/django/patch.py -- -vvv -s --tb=short + $ scripts/run-tests tests/contrib/django/ -- -- -k test_specific_function + + # Add both riot (first) and pytest (second) arguments + $ scripts/run-tests ddtrace/contrib/django/patch.py -- -s -- -vvv -s --tb=short # Run specific test functions $ scripts/run-tests tests/contrib/flask/ -- -k "test_request or test_response" diff --git a/scripts/run-tests b/scripts/run-tests index da864238f2a..a0282726728 100755 --- a/scripts/run-tests +++ b/scripts/run-tests @@ -655,8 +655,14 @@ Examples: # Show what would be run without executing scripts/run-tests --dry-run + # Pass additional arguments to riot + scripts/run-tests ddtrace/contrib/django/patch.py -- -s + # Pass additional arguments to pytest - scripts/run-tests ddtrace/contrib/django/patch.py -- -vvv -s --tb=short + scripts/run-tests ddtrace/contrib/django/patch.py -- -- -vvv -s --tb=short + + # Pass additional arguments to riot (first) and pytest (second) + scripts/run-tests ddtrace/contrib/django/patch.py -- -s -- -vvv -k api --tb=short """, ) From 07f9335f108968fe976276dfdcb1cc07c5409b54 Mon Sep 17 00:00:00 2001 From: Christophe Papazian <114495376+christophe-papazian@users.noreply.github.com> Date: Fri, 5 Dec 2025 16:05:21 +0100 Subject: [PATCH 3/3] Update docs/contributing-testing.rst Co-authored-by: T. Kowalski --- docs/contributing-testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/contributing-testing.rst b/docs/contributing-testing.rst index 8fad252557d..dd62a9671ef 100644 --- a/docs/contributing-testing.rst +++ b/docs/contributing-testing.rst @@ -81,7 +81,7 @@ The ``scripts/run-tests`` script handles this automatically: .. code-block:: bash - # Add riot arguments for avoid unnecessary compilation + # Add riot arguments to avoid unnecessary compilation $ scripts/run-tests tests/contrib/django/ -- -s # Add pytest arguments for test selection