Skip to content

Snapshots

RSnapshot

Snapshot testing against reference outputs recorded from R.

This object is provided by the r_snapshot fixture. In replay mode, it reads snapshot files and compares them to Python-generated outputs. In record/auto modes, it executes the labelled R chunk and writes the snapshot file.

assert_match_text(actual, *, name, ext='.txt', normalize=None, code=None)

Assert that actual matches the expected snapshot content.

path_for(name, *, ext='.txt')

Return the on-disk path for a snapshot.

read_text(name, *, ext='.txt')

Read a text snapshot from disk.

record_text(name, *, ext='.txt', code=None)

Execute the R code for name and write its output as a snapshot.