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
10 changes: 5 additions & 5 deletions .claude/skills/run-tests/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -121,7 +121,7 @@ This will:

For re-running specific tests:
```bash
scripts/run-tests --venv <hash> -- -vv -k test_name
scripts/run-tests --venv <hash> -- -- -vv -k test_name
```

## When Tests Fail
Expand Down Expand Up @@ -243,15 +243,15 @@ 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

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
```

Expand Down Expand Up @@ -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

Expand Down
9 changes: 7 additions & 2 deletions docs/contributing-testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 8 additions & 2 deletions scripts/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
Expand Down Expand Up @@ -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
""",
)

Expand Down
Loading