Skip to content
Open
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
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@ $ npx prism mock path/to/your/openapi.yml
$ ./scripts/test
```

### Snapshots

Some tests use [inline-snapshot](https://15r10nk.github.io/inline-snapshot/latest/). To update them after making changes, rerun the tests with the `--inline-snapshot=fix` and `-n0` options:

```bash
./scripts/test --inline-snapshot=fix -n0
```

> [!NOTE]
> `inline-snapshot` is incompatible with [pytest-xdist](https://github.com/pytest-dev/pytest-xdist), so you need to disable parallel execution `(-n0)` when using the `--inline-snapshot` option.

In addition, some tests capture snapshots of the HTTP requests they make.
To refresh these snapshots, run the tests with the `ANTHROPIC_LIVE=1` environment variable enabled.

```bash
ANTHROPIC_LIVE=1 ./scripts/test --inline-snapshot=fix
```

> [!NOTE]
> Sometimes it makes sense to update only the inline snapshots `(--inline-snapshot=fix)` without refreshing the HTTP snapshots `(ANTHROPIC_LIVE=1)`.
> This is useful when the endpoint hasn’t changed, but your code handles the response differently and the assertions need updating.

## Linting and formatting

This repository uses [ruff](https://github.com/astral-sh/ruff) and
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/tools/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#
# you can update them with
#
# `ANTHROPIC_LIVE=1 pytest --inline-snapshot=fix -p no:xdist -o addopts=""`
# `ANTHROPIC_LIVE=1 ./scripts/test --inline-snapshot=fix -n0`

snapshots = {
"basic": {
Expand Down