Re: Best practices for distributing and testing an interface file
William S Fulton <[email protected]> Wed, 10 Mar 2021 19:49:09 +0000
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftAtMaRP3xyH6zmB2Awe+PLOPRbUOs0mJwXLO9jVgHnqXQ@mail.gmail.com> |
Hi Matti I suggest you add some tests to your continuous integration. You would test the SWIG wrappers in numpy.i like you would for any other Python code. Use whatever framework you have set up or use something like pytest. I'd have thought you could crib any Python sequence tests and adapt for numpy testing quite easily. A long long time ago we didn't have any tests for SWIG and now we add a testcase for every bug/feature added and nowadays have fairly good coverage. It's never too late to start adding tests! There are a pile of tests in SWIG you could copy, such as this simple interface file, https://github.com/swig/swig/blob/master/Examples/test-suite/li_std_containers_int.i. The runtime tests are in https://github.com/swig/swig/blob/master/Examples/test-suite/python/li_std_containers_int_runme.py and are fairly comprehensive. They test Python list functionality with C++ std::vector<int> wrappers. Good luck William On Tue, 2 Mar 2021 at 14:56, Matti Picus <[email protected]> wrote: > Over at NumPy, we have a numpy.i SWIG interface file, but are not > distributing it with our python wheels or source tarball. Two reasons: we > do not really know where to put it, and we do not have good tests for it. > > > How are people testing their interface files? Are there coverage-like > tools to determine which parts of the file have been tested? Are there some > liberally licensed examples we could add to our CI? We occasionally get > requests to modify the file, and are hesitant to do so until we know we > will not break anything. > > > Are there any domain experts who would like to be the NumPy SWIG expert? > > > For instance, this PR seems harmless, but who knows without tests > > https://github.com/numpy/numpy/pull/18522 > > > Thanks, > > Matti > _______________________________________________ > Swig-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/swig-user > _______________________________________________ Swig-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swig-user