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
18 changes: 18 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@
_Notes on the upcoming release will go here._
<!-- END PLACEHOLDER - ADD NEW CHANGELOG ENTRIES BELOW THIS LINE -->

### Breaking changes

#### Refresh persisted boxed VT expectations (#151)

Syrupy stores nested terminal frames in separate keyed sections. Boxed
snapshots record display columns when frame text admits more than one cell
layout. Review the changed output and update affected expectations with
`pytest --snapshot-update`.

### Fixes

#### Pair boxed snapshot rows by viewport index (#151)

{func}`~libvt.testing.format_vt_diff_lines` compares screen rows at matching
viewport indices and lists changed or reordered style spans.
{class}`~libvt.contrib.syrupy.VtSnapshotExtension` labels changed screens
inside containers by their key path.

## libvt 0.0.1a5 (2026-11-30)

`libvt` 0.0.1a5 adds rectangular grid blitting, display-column text writes, and
Expand Down
8 changes: 8 additions & 0 deletions MIGRATION
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ downstream projects (and `>=0.x,<0.y` once `0.1.0` is released).
_Detailed migration steps for the next version will be posted here._
<!-- END PLACEHOLDER - ADD NEW MIGRATION ENTRIES BELOW THIS LINE -->

### Boxed step diffs (#151)

{func}`~libvt.testing.vt_screen` with `diff=` and {fixture}`vt_snapshot` with
`diff=` pair rows at the same viewport index. Container snapshots store VT
frames with supported key paths in separate sections. Frames with ambiguous
display columns record those columns in a footer. Review the diff and
regenerate affected `.ambr` expectations with `pytest --snapshot-update`.

## libvt 0.0.1a2 (2026-11-28)

### Curated PEP 562 `libvt` root exports (#43)
Expand Down
26 changes: 20 additions & 6 deletions docs/topics/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ diff highlighters when `ESC` bytes split across color spans.
{func}`~libvt.testing.serialize_vt_snapshot` serializes terminals, snapshots,
{class}`~libvt.screen.Screen` grids, {meth}`~libvt.screen.Screen.region`
slices, {class}`~libvt.contrib.tmux.capture.TmuxCaptureResult` bundles, and
duck-typed pane objects into three plain-text sections:
duck-typed pane objects into these plain-text sections:

1. A canonical metadata header (`size`, `cursor`, `alt`, non-default `modes`).
2. A column-exact Unicode `┌──┐` viewport box read from
{attr}`~libvt.terminal.Terminal.committed`.
3. Run-length `styles:` spans recording `SGR` attributes, 16/256/RGB colors,
3. Optional run-length `styles:` spans recording `SGR` attributes, 16/256/RGB colors,
underline colors, and `OSC 8` hyperlinks.
4. An optional `columns:` footer for rows whose cell boundaries cannot be
recovered from the text and box width alone.

```python
>>> import libvt
Expand Down Expand Up @@ -156,9 +158,10 @@ row 1 cols 0..1: '1' -> '2'

### Compact failure diffs

{func}`~libvt.testing.format_vt_diff_lines` leads with `header:`,
`row R cols C0..C1:`, and `styles:` summaries ahead of column-aligned `^`
carets (or ANSI-styled lines when callbacks are supplied):
{func}`~libvt.testing.format_vt_diff_lines` pairs two boxed snapshots by
viewport row. The diff starts with changed header, row and style summaries.
Carets mark changed display columns. Set `color=True` and supply style callbacks
to show colored expected and received lines.

```python
>>> import libvt
Expand All @@ -173,7 +176,7 @@ carets (or ANSI-styled lines when callbacks are supplied):
... )
>>> print("\n".join(diff[:3]))
row 0 cols 6..10: 'PASS' -> 'FAIL'
styles: [' r0[0..10]: fg=green'] -> [' r0[0..10]: fg=red']
styles: r0[0..10]: fg=green -> r0[0..10]: fg=red
size=12x1 cursor=(0,10,vis=True) alt=False modes=[]
```

Expand Down Expand Up @@ -242,6 +245,17 @@ from `pytest --fixtures` when `syrupy` is uninstalled or disabled via
>>> test_worker_row(_CheckAmbr()) # doctest: +HIDE
```

When a dict, list or tuple contains screens, Syrupy labels their diffs with
paths such as `[panes][('logs', 1)]`. Dictionary paths accept built-in strings,
bytes, integers, booleans, finite floats, `None`, and tuples or frozensets of
those keys. The `.ambr` snapshot stores those screens in separate sections.
Paths with other keys, ordinary values, and legacy container snapshots use
Syrupy's line diff.

For independently named assertions, use
`assert vt_screen(left) == vt_snapshot(name="left")` for one screen and
`assert vt_screen(right) == vt_snapshot(name="right")` for the next.

### Project-wide `.ambr` scrubbers

To share scrubbers across every `.ambr` test in a repository, build a memoized
Expand Down
Loading
Loading