NonMockObjects

NonMockObjects is a Python testing library designed to make it feasible to test your application with real objects easily and flexibly.

The actual code contribution of this library is fairly minimal; what NonMockObjects offers is more a certan coding structure and some useful support that helps make this really easy.

At the moment, documentation is included only in the distribution file, which can be obtained from the Cheeseshop listing for this module. For a more conversational introduction to what this does, see the blog post on this topic.

How To Tell If You Need This Module

You want to run automated tests on your code, but you have a relatively complicated data model, perhaps a nicely normalized database. The bulk of your tests consist of setting up this relatively complicated data model, and the tests all break whenever you change your model. Constructing the data has become so difficult (and breaks so often) that you've just stopped testing entirely.

NonMockObjects helps you build a framework so that creating a test account is as easy as "data.account()" in the simplest case, no matter how complicated your account creation process is.

Documentation

epydoc generated documentation is included in the distribution. The latest version can be seen here.

Note that unlike much/most epydoc-generated documentation, the default page is actually useful; in the main module documentation there's an introduction and tutorial.

Latest Version

NonMockObjects is currently at 0.2.0. 0.2.0 adds Variation support.

Download it from the Cheeseshop listing.

It is quite possible this will get bumped to 1.0 with no changes.

About NonMockObjects

NonMockObjects is a port of a Perl library I wrote at work, albeit heavily modified and simplified thanks to Python's vastly superior function argument introspection. Thus, while the Python code is young, the idea has been tested commercially for many months in an environment where we use very normalized databases and relatively complicated account setup procedures and such. (We find we are more free to do so, because the Perl equivalent module allows us to unit test these more complicated setups easily.)

I am currently using this module to drive the testing of my not-yet-deployed weblog, so I don't have quite as much Python experience with this library as I do Perl. If you find that there is a recurring pattern you encounter that you think should be supported more directly, please let me know; it is almost certain there are such patterns. (I've got a couple in mind but I wanted to get the 0.1 release out so people can start commenting on it; release early, release often.)

Please feedback to jerf@jerf.org, and due to overly-excitable spam filters, it would help if you put NonMockObjects in the subject somewhere to improve the chances I'll see it.

Jerf.org : NonMockObjects - Python Testing Library

 

Current Section Links

 

Search Jerf.org
Google

Search WWW
Search jerf.org