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..dd62a9671ef 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 to 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 c3a551cd9af..a0282726728 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)}") @@ -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 """, )