ANN: mock 0.6.0, Python mocking and testing library

Fuzzyman fuzzyman at gmail.com
Sat Aug 22 17:25:08 EDT 2009


mock is a Python mock object library for testing, with additional
support for runtime monkey patching.

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.

This release, version 0.6.0, is a minor release but with a few new
features:

* mock homepage http://www.voidspace.org.uk/python/mock/
* download http://www.voidspace.org.uk/downloads/mock-0.6.0.zip
* PDF documentation http://www.voidspace.org.uk/downloads/mock.pdf
* Google code project and SVN repository http://code.google.com/p/mock/

New in 0.6.0:

* New test layout compatible with test discovery
* Descriptors (static methods / class methods etc) can now be patched
and restored correctly
* Mocks can raise exceptions when called by setting side_effect to an
exception class or instance
* Mocks that wrap objects will not pass on calls to the underlying
object if an explicit return_value is set




More information about the Python-list mailing list