
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. 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. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations

"Fred L. Drake, Jr." wrote:
Wouldn't it be better to explicitly name the test script using a keyword parameter to setup() ?
Some comments: * 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 -- Marc-Andre Lemburg ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Pages: http://www.lemburg.com/python/

M.-A. Lemburg writes:
Wouldn't it be better to explicitly name the test script using a keyword parameter to setup() ?
I think that would be a good elaboration, but something simple like this would be useful for the typical case.
* test (if available) should be run prior to install
Agreed; I didn't want to mess with the other commands until we determine whether it should go in.
* installing should not be possible with failing tests (errors) unless an override option is used
Fair enough.
* the test command should have an option to turn warnings into errors
Are they treated differently? What's missing is that I don't know offhand how to raise the error condition for distutils, otherwise I would. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations

"Fred L. Drake, Jr." wrote:
Wouldn't it be better to explicitly name the test script using a keyword parameter to setup() ?
Some comments: * 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 -- Marc-Andre Lemburg ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Pages: http://www.lemburg.com/python/

M.-A. Lemburg writes:
Wouldn't it be better to explicitly name the test script using a keyword parameter to setup() ?
I think that would be a good elaboration, but something simple like this would be useful for the typical case.
* test (if available) should be run prior to install
Agreed; I didn't want to mess with the other commands until we determine whether it should go in.
* installing should not be possible with failing tests (errors) unless an override option is used
Fair enough.
* the test command should have an option to turn warnings into errors
Are they treated differently? What's missing is that I don't know offhand how to raise the error condition for distutils, otherwise I would. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Digital Creations
participants (2)
-
Fred L. Drake, Jr.
-
M.-A. Lemburg