[capi-sig] How to do C api testing with python

M.-A. Lemburg mal at egenix.com
Mon Dec 3 10:48:54 CET 2007

On 2007-12-03 07:51, Vijay Manohar wrote:
> Hi All,
> I have been working with python for a month, I have really loved using
> python for testing different tools and basically in automating the GUI
> related to windows, and also on web.
> Now I have a huge task to test in front of me, we are developing an API, and
> I feel like I have to test the API so that I have to make sure that how well
> it works in a given typical failure conditions.
> Can anyone suggest me how to do API testing of C using python.
> I have searched out in google and only found a link which creates a wrapper
> around the api and uses.
> But I would like to test the API in a pythonic way.
> Any help is really appreciated.

You could use an extension module for this, much like Python itself
does with _testcapimodule.c.

Alternatively, you might want to look
at the ctypes module. However, I'd only recommend that if you already
have a good feeling that most of the C API you're testing does work,
since ctypes indirects the testing.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Dec 03 2007)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the capi-sig mailing list