MemotivaTesting in Python

What is monkey patching?

Testing in Python

Audio flashcard · 0:14

Nortren·

What is monkey patching?

0:14

Monkey patching is the practice of modifying or extending objects at runtime, typically to substitute behavior for testing. Pytest provides the monkeypatch fixture for safe, scoped patching. Direct monkey patching outside tests is generally considered fragile and should be used sparingly.
docs.pytest.org