email@example.com (Berthold Höllmann) writes:
I'm thinking about providing a framework for pre-install testing for distutils enabled Python packages. I think about a new "test" command, which inserts the lib build path into PYTHONPATH and runs specified tests. Is anyone else working on something like this, and what are your opinions and requirements on this?
Attatched you find a first version of test.py. This copied into ../distutils/command allows
python setup.py test
First this command calls "build" to enshure a correctly build disttribution.
It then modifies "sys.path" to point it to the build directory, imports files from a subdirectory, and calls a function named "test" in the imported module. The default name of the subdirectory is "test". From this directory by default all modules named "test_*.py" are imported.
Additional options are:
- test_dir (test-dir): name of the directory containg the test files (default: "test")
- test_prefix (test-prefix): prefix for the test files. (default: "test_")
- test_suffixes (test-suffixes): suffixes used to generate filenames for the tests (default: None, which means: look for all files in test_dir named test_prefix<something>.py and list all <somethings>s for test_suffixes).
I took build.py as a template for writing this.