Skip to content

ditto update

Re-run pytest with --ditto-update to re-record snapshots.

Every snapshot the run reaches is overwritten with the current value. A full, passing run also rebuilds ditto.lock. Any extra arguments are passed directly to pytest.

Usage:

ditto update [OPTIONS] [PYTEST_ARGS]...

Options:

  --help  Show this message and exit.

Examples

# Update all snapshots
ditto update

# Update snapshots in a specific directory
ditto update tests/ci/

# Update specific tests
ditto update tests/ci/ -k test_foo

Screenshot

ditto update

Behaviour

  • Runs pytest with --ditto-update flag
  • Every snapshot encountered during the run is re-recorded from current output
  • Existing snapshot files are overwritten
  • New snapshots are created as normal

Tip

After updating, review the diff in version control to verify the changes are intentional.