openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #09723
Re: mock, mox, stubs, fakes, etc
mox and mock are two competing Python libraries for defining mock objects for unit tests. I think they're basically equivalent in terms of what you can do with them, but they use different styles: In mox the assertions are written before the code under test, and in mock the assertions are written after the code under test.
I personally think mock is more Pythonic, and it's what I use on other projects. Mox is a port of a Java library, and mock was (AFAIK) written specifically for Python. Also, Mock has been accepted into the Python 3.3(?) standard library as a submodule of unit tests. However, mox has been the main mocking library used in Nova unit test for as long as I have been familiar with the code.
Take care,
Lorin
--
Lorin Hochstein
Lead Architect - Cloud Services
Nimbis Services, Inc.
www.nimbisservices.com
On Apr 8, 2012, at 4:06 PM, Joseph Heck wrote:
> Poking around through all various mechanisms we have to test and verify OpenStack - does anyone have a concise writeup on the various tools and techniques that we're using?
>
> I'm not familiar with the "stubs" or "mock" libraries, and a little familiar with mox.
>
> Is anyone who is familiar with them all willing to take a stab at outlining where they're individually most effective and useful?
>
> -joe
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp
Follow ups
References