Python: Advice for Patching Your Code at Runtime

from blog JJinuxLand, | ↗ original
A lot of people use mock.patch() in their tests, but it's also sometimes useful to monkey-patch code at runtime. This blog post talks about why and how. Let's imagine that you're using some library (perhaps something big, like a web framework), and for whatever reason, you're unable to update the version you're using. Meanwhile, someone comes...