Python mock vs unittest.mock patch

Yes, both are the same but there is one major difference in them. It looks like the Mock version used in python mock is 1.0.0 which caused errors in my test cases due to dependency on the latest version.

https://github.com/python/cpython/blob/c1f1ddf30a595c2bfa3c06e54fb03fa212cd28b5/Lib/unittest/mock.py#L26


The mock library has been integrated into the Python standard library from Python version 3.3 on as unittest.mock. They deliver the same functionality.

Nowadays the (external) mock library is a backport of the version in the standard library. If you are using a recent version of Python and don't have any special version requirement, the version from the standard library should be preferred.