If I'm writing a library in C that includes a Python interface, is it OK to just write unit tests for the functions, etc in the Python interface? Assuming the Python interface is complete, it should imply the C code works.
Mostly I'm being lazy in that the Python unit test thing takes almost zero effort to use.
thanks, -nick
Tests through the Python interface will be valuable acceptance tests for your library. They will not however be unit tests.
Unit tests are written by the same coders, in the same language, on the same platform as the unit which they test. These should be written too!
You're right, though, unit testing in Python is far easier than C++ (or even C, which is what you said!).
If you only care if the Python library works, then test that. This will give you significant confirmation that the C library is robust, but the maxim "if you didn't test it, it doesn't work" still mostly applies and I wouldn't export the library without the test harness.
You could, in theory, test that the processor microcode is doing its job properly but one usually doesn't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With