Couple of years ago I wrote silvermock - http://github.com/silverstripe/silvermock

It uses an expectation style like so:

mock = MockObject("mock class", [
ShouldBeCalled("__init__"),
ShouldBeCalled("function").with_args((1,2))
])
obj = mock()
obj.function(1,2)
mock._instance.verify()

You can see more usage examples in the MockObjectTest suite.

There is also

minimock - http://pypi.python.org/pypi/MiniMock
Python Mocker - http://labix.org/mocker

--
Siddharta Govindaraj

On 27-Jan-10 6:37 PM, Diptanu Choudhury wrote:
Yes, and also the unit tests tend to become more verbose with Mox.

On Wed, Jan 27, 2010 at 2:42 PM, Noufal Ibrahim<nou...@gmail.com>  wrote:

On Wed, Jan 27, 2010 at 6:05 PM, Diptanu Choudhury
<admin.nitj...@gmail.com>  wrote:
Hi,

We ran into a discussion this afternoon about the various Python Mocking
Libraries. The popular one out there seems to be Mox(according to
my colleagues), though I like Mock(python-mock).

I would like to hear the views of the python veterans of this list about
the
popular mocking libraries! :-)
I recently needed one and looked through a few. I found the whole
record/replay style a little weird and preferred a post mortem
approach. With that in mind, I found
http://www.voidspace.org.uk/python/mock/ quite nice and it's what I
use.




--
~noufal
http://nibrahim.net.in
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers




_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to