[TIP] TestFixtures 1.8.0 Released!
whatsjacksemail at gmail.com
Fri Jan 14 06:53:38 PST 2011
Thanks for that. I'll give it a go.
On Fri, Jan 14, 2011 at 2:49 PM, Chris Withers <chris at simplistix.co.uk>wrote:
> Hi Jack,
> On 14/01/2011 14:39, Jack Keegan wrote:
>> objects. In particular, at the moment, testing some code that needs to
>> access hardware IOs using DLLs. I do this using Ctypes.
>> However, on my dev machine, I don't have the same hardware so calling
>> the DLL functions will not work as expected. Therefore I'd like to mock
>> out the ctypes dll calls. Can you give me an indication of how you would
>> go about doing this with TestFixtures? Just so you know, I use py.test for
>> unit testing.
> I've not used ctypes myself so let me know if things don't work ;-)
> I'd suggest developing mock objects to work in place of your ctypes
> objects. You may well find that if you're just wanting to test that the
> right calls are made you can use an existing mock objects such as:
> ...and then compare the method_calls attribute of the mock with what you
> expect it to be.
> TestFixtures provides some handy tools for managing the insertion and
> removal of mock objects, read here:
> Simplistix - Content Management, Batch Processing & Python Consulting
> - http://www.simplistix.co.uk
The earth is a very small stage in a vast cosmic arena. Think of the rivers
of blood spilled by all those generals and emperors so that in glory and in
triumph they could become the momentary masters of a fraction of a dot.
- Carl Sagan [Pale Blue Dot]
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python