mock (unit test library for Python 2) mock is a library for testing in Python 2. It allows you to replace parts of your system under test with mock objects, and to make assertions about how they have been used. IMPORTANT: For Python3 you do not need this module. Please use the standard library instead (unittest.mock). This package contains a rolling backport of the standard library compatible with Python 2.7.