mitmproxy/docs/src
ChrisJr404 0fb62c456c
docs: document addon live-reload + testing pattern (#8210)
* docs: document addon live-reload + testing pattern

Issue #6377 asked for addon development docs covering hot reload and
testing. mitmproxy already watches scripts loaded with -s for changes
and re-imports them on save (mitmproxy/addons/script.py: Script.watcher
and the unconditional Script(s, True) at line 218), but that behavior
was undocumented, and there was no canonical example of how to unit-test
a custom addon with mitmproxy.test.taddons / mitmproxy.test.tflow.

Add a "Developing Addons" section to docs/src/content/addons/overview.md
with two subsections:

- Live Reloading: explains the file-watcher behavior, including which
  errors leave the previous version unloaded and which don't.
- Testing Addons: a small example that unit-tests the Counter addon from
  anatomy.py using taddons.context() and tflow.tflow(), plus a pointer
  to tctx.cycle() and the existing test/mitmproxy/addons/ tests for
  patterns that need the full event sequence.

No code changes.

* reduce testing section

Testing helpers are currently a bit ugly and not part of the public API, so let's not put them front center in the docs.

---------

Co-authored-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
2026-05-11 14:18:51 +00:00
..
archetypes
assets Docs: Add Search Bar (#7603) 2025-03-15 08:02:58 +01:00
content docs: document addon live-reload + testing pattern (#8210) 2026-05-11 14:18:51 +00:00
generated
layouts Docs: Add Search Bar (#7603) 2025-03-15 08:02:58 +01:00
static
config.toml Docs: Add Search Bar (#7603) 2025-03-15 08:02:58 +01:00
examples