Using the code for more than what the original authors intended is usually a good sign, in that the code provides useful tools. As far as re-purposing modules "outside of their intent" is concerned, well... this is obviously subjective and depends to what extent.
Using raw I/O functions in
imaplib to implement some unrelated socket-based communication protocol could be considered bad style (to say the least). However, using the same
imaplib library to implement some private variant of the IMAP protocol (unlikely to be the intended use) would be IMHO less of a problem.
It's totally understandable that you would find some convenient classes and methods in the
unittest module to implement other types of tests. However, the problem is often one of code readability. To most Python developers, seeing the
unittest module closely to the idiomatic recommended usage probably conveys the meaning of "this piece of code is a unit test". In terms of "self-documenting code", this is a total failure in the sens that it is misleading for other developers.
Ideally, this would be a non-question. The solution would be to refactor the
unittest module so that code not specific to unit tests is moved to a
test module or
testbase module or some such thing. However, you might find a lot of resistance in such an effort, for political and practical reasons. It is, after all, a standard library module and can't be modified as easily as your own project.
Does it fly in the face of the Pythonic view to reuse / repurpose python modules for projects out side of their intent?
In general, I don't think this is "anti-Pythonic", although I think the fact that these comments have occured several times should mean something.
Maybe you can write some sort of
systemtest module that imports the re-usable stuff from the
unittest module. It's a temporary solution that gives both code clarity and allows you to re-use the code directly. Then, you can write a long comment in the
systemtest module about how all the workarounds are actually better than writing your own test runner.