Deux ressources autour du monkeypatching et de la création de mocks pour des tests :

- Bob Benderbos : https://belderbos.dev/blog/python-mock-patch-verify-interception/
- Anthony Sottile : https://www.youtube.com/watch?v=ZW0QaclnJKA

#Python #craft #monkeypatch #test #mock #pytest

How to Tell if Your Python Mock Is Actually Working

A test that passes because the real API returned an error is not a passing test. Here's how to verify your mock is intercepting, and fix it when it isn't.

🐍🔨 Oh, look at you, Mr. #Python Wizard, magically monkey-patching #code at runtime like it's a circus act! 🎩✨ Because who doesn't love trading #security for a few moments of smug brilliance? 🙄
https://ericmjl.github.io/blog/2025/8/23/wicked-python-trickery-dynamically-patch-a-python-functions-source-code-at-runtime/ #MonkeyPatch #SmugBrilliance #CircusAct #HackerNews #ngated
Wicked Python trickery - dynamically patch a Python function's source code at runtime

Luckily, two programs were set to #log progress and the #code could be #patched to skip previously computed steps.

A third program was not so lucky. None of the work is important, but losing it, or even figuring out how to #monkeyPatch it, is annoying.