[Openstack] Test Dependencies

Maru Newby mnewby at internap.com
Tue Mar 6 06:29:19 UTC 2012


Hi Jay,

On 2012-03-02, at 10:17 AM, Jay Pipes wrote:

> 
> ++ to unittest2. Frankly, it's a dependency of sqlalchemy, so it gets installed anyway during any installation. Might as well use it IMHO.

Good to know!


>> Separately, is the use of mox open to discussion?  mock was recently added as a dependency to quantum to perform library patching, which isn't supported by mox as far as I know.
> 
> This is incorrect. pymox' stubout module can be used to perform library patching. You can see examples of this in Glance and Nova. For example:
> 
> https://github.com/openstack/glance/blob/master/glance/tests/unit/test_swift_store.py#L55

Thank you for the clarification.  I'll make sure quantum removes the mock dependency and uses mox instead.


> Might be easier to answer with some example code... would you mind pastebin'ing an example that shows what mock can do that mox can't?

I've done some experimentation and there isn't anything that mock can do that mox can't (or vice-versa).  I have found mox to be unnecessarily verbose though - the requirement to configure everything up-front makes for a lot of busywork for many use-cases.  As unittest2 is a thoughtful revision to the standard library's unittest module, so is mock a similarly thoughtful revision to the record/replay mocking of mox (in fact unittest2 and mock share an author).  In an ideal world, both mox and mock could be used on a project, but from a pragmatic standpoint there can be only one and the existing investment in mox leaves little room for another library.

Thanks,


Maru



More information about the Openstack mailing list