mock with inheritance

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Jul 9 07:12:25 EDT 2008


lidiriel <ludovic.mercier at gmail.com> writes:

> But i don't know how to mock the class Component. Note that Component
> provide the attribut env.

I prefer to use the MiniMock framework
<URL:http://cheeseshop.python.org/pypi/MiniMock>.

You don't need to specify what interface the mock object has. Its Mock
objects will allow *any* attribute access, method or otherwise, and
simply report what was done. You can then check that report to see if
it matches what you expect; the author suggests that the existing
standard-library 'doctest' module is ideal for such checking.

-- 
 \       “It is the mark of an educated mind to be able to entertain a |
  `\                         thought without accepting it.” —Aristotle |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list