Posts on the topic of wrapture, a Python package for monkey patching, testing and tracing built on top of wrapt, are as follows.

The starting point, on what wrapture is, why I built it, and how it was written:

This batch of posts covers using wrapture in unit tests, where the difference from unittest.mock is that the real code still runs and everything that flows through it is recorded:

This batch of posts covers the tracing side, where the same bindings used in tests observe a running application instead, from a live call tree in a terminal through to spans in an OpenTelemetry backend:

The documentation is the reference for everything the posts skip over, and the older posts collected under decorators and monkey patching cover wrapt, the library wrapture is built on.