mock module in Python
Let’s discuss a mock module of python, its uses and significance.
The unittest
module now includes a mock
submodule as of Python 3.3.
It will allow us to replace portions of the system that we are testing with mock objects as well as make assertions about how they were used. A mock object is used for simulating system resources that aren’t available in our test environment.
In other words, we will find times when we want to test some part of our code in isolation from the rest of it or we will need to test some code in isolation from outside services.
Get hands-on with 1400+ tech skills courses.