Top "Monkeypatching" questions

Dynamically modifying run-time behavior by replacing program elements with new program elements

How To Run Arbitrary Code After Django is "Fully Loaded"

I need to perform some fairly simple tasks after my Django environment has been "fully loaded". More specifically I need …

python django monkeypatching django-signals
Adding base class to existing object in python

I have several objects of different kinds (different function names, different signatures) and I monkey patch them to have a …

python inheritance metaclass monkeypatching
How to mock a decorated function

For testing reasons, I need to be able to mock the inner/original function of a decorated one which is …

python unit-testing mocking decorator monkeypatching
Is it possible to monkey patch in Java?

I don't want to discuss the merits of this approach, just if it is possible. I believe the answer to …

java reflection monkeypatching
Add functionality to Django FlatPages without changing the original Django App

I would like to add a field to the Django FlatPage database model, but I do not really know how …

django django-models monkeypatching
Is it possible to replace (monkeypatch) PHP functions?

You can do this in Python, but is it possible in PHP? >>> def a(): print 1 ... >>&…

php function monkeypatching
How to mock a function, that is imported within an imported method from different module

I got the following function to test: my_package.db_engine.db_functions.py: from ..utils import execute_cmd from …

python unit-testing mocking monkeypatching
Why is it frowned upon to modify JavaScript object's prototypes?

I've come across a few comments here and there about how it's frowned upon to modify a JavaScript object's prototype? …

javascript monkeypatching
Golang monkey patching

I understand that if go code is structured such that it's programmed to interfaces, it's trivial to mock; however, I'm …

go mocking monkeypatching
What is the difference between mocking and monkey patching?

I work with python and I'm a bit new to testing. I often see tests replacing an external dependency with …

python unit-testing testing mocking monkeypatching