Vibeleaderboard
← All Intel
Intel / article

Introducing wrapture

Source
simonwillison.net
Date

Context

Wrapture is a Python library for observing or changing selected function calls without rewriting the functions themselves. Its documentation says it reaches code by name and installs a wrapper around the real callable. By default the real call runs and is recorded; a developer can instead have the wrapper transform arguments or results, or return a value without running the real code.

Simon Willison's post introducing it quotes two test examples from creator Graham Dumpleton's follow-up: one replaces a payment method's result entirely, while the other runs the real method and changes only the returned identifier. That gives developers a precise way to control the part of an interaction under test while retaining other real behavior.

Read the source simonwillison.net
Recommended reads
Comments

Checking sign-in…

Loading comments…