我们最喜欢的Python模拟库是什么?
时间:2020-03-06 14:24:02 来源:igfitidea点击:
我们最喜欢的Python模拟库是什么?
解决方案
我只使用了一个,但是在Michael Foord的Mock中取得了很好的效果:http://www.voidspace.org.uk/python/mock/。
迈克尔的介绍说,这比我做的更好:
There are already several Python mocking libraries available, so why another one? Most mocking libraries follow the 'record -> replay' pattern of mocking. I prefer the 'action -> assertion' pattern, which is more readable and intuitive particularly when working with the Python unittest module. ... It also provides utility functions / objects to assist with testing, particularly monkey patching.
过去我曾经使用过pMock,并且不介意,它也有相当不错的文档。但是,如上所述的Foord's Mock也不错。
Mox,来自Google
来自Gustavo Niemeyer的Mocker。
它并不完美,但功能强大且灵活。
加里·伯恩哈特(Gary Bernhardt)撰写的《丁格斯》。