[Python-ideas] Builtin test function
fredrik.johansson at gmail.com
Thu Mar 19 10:59:08 CET 2009
There's been some discussion about automatic test discovery lately.
Here's a random (not in any way thought through) idea: add a builtin
function test() that runs tests associated with a given function,
class, module, or object.
>>> import myproject
By default, test(obj) could simply run all doctests in docstrings
attached to obj. For modules, it could also look for unittest.TestCase
instances, and perhaps do some more advanced test discovery. test()
could implement some keyword options to control exactly what and what
not to do. There could perhaps also be a corresponding __test__
method/function for implementing custom test runners.
More information about the Python-ideas