Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def test_something():
- original_func = my_module.my_func
- if 'MAKE_EXTERNAL_REQUESTS' not in os.environ:
- # Monkey patch manually
- my_module.my_func = lambda x: x
- # do some logic that depends on my_module.my_func
- ...
- # Unpatch
- my_module.my_func = original_func
Add Comment
Please, Sign In to add comment