mock 0.4.0
A Python mock object library
Latest Version: 0.6.0
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. For a discussion of the merits of the two approaches, see Mocking, Patching, Stubbing: all that Stuff.
mock provides a core Mock class that is intended to reduce the need to create a host of trivial stubs throughout your test suite. After performing an action, you can make assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set specific attributes in the normal way.
It also provides a patch decorator that handles patching module and class level attributes within the scope of a test, along with sentinel for creating unique objects.
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| mock-0.4.0-py2.5.egg (md5) | Python Egg | 2.5 | 2008-10-12 16:22:44 | 5KB | 846 |
| mock-0.4.0-py2.4.egg (md5) | Python Egg | 2.4 | 2008-10-12 16:22:30 | 5KB | 380 |
| mock-0.4.0-py2.6.egg (md5) | Python Egg | 2.6 | 2008-10-12 16:23:10 | 5KB | 407 |
- Author: Michael Foord <fuzzyman at voidspace org uk>
- Home Page: http://www.voidspace.org.uk/python/mock.html
- Download URL: http://www.voidspace.org.uk/downloads/mock-0.4.0.zip
- Keywords: testing test mock mocking unittest patching stubs
- License: BSD
- Categories
- Package Index Owner: Fuzzyman
- DOAP record: mock-0.4.0.xml
Log in to rate this package.
