"Fred L. Drake, Jr." wrote:
I'm sure others have taken a stab at this, but I'd like to suggest that we include some support for a standard test command for setup.py. I've attached the command I've been playing with, but would love to hear other suggestions as well. Drop the attached file into the standard library as distutils/command/test.py. It adds the command "test" parallel to the "build" and "install" commands. It expects a directory named "test" parallel to the setup.py script; that directory is searched for Python module files named test_*.py. Each such module is imported; if a callable named test_suite() is found, it should return a unittest.TestSuite instance that can be run.
Wouldn't it be better to explicitly name the test script using a keyword parameter to setup() ?
I'm sure there's a better way to report failures, but I haven't had time to dig that deeply into the distutils yet.
* test (if available) should be run prior to install * installing should not be possible with failing tests (errors) unless an override option is used * the test command should have an option to turn warnings into errors