Could you please consider to utilize built-in unittest.mock instead of mock? https://trello.com/c/S6eADbii/64-remove-python-mock https://fedoraproject.org/wiki/Changes/DeprecatePythonMock It works for 3.6 to 3.10 at least: https://build.opensuse.org/package/show/home:pgajdos:python/python-elasticsearch