#49 closed enhancement (fixed)
A easy to use replacement to unittest to output it's results in XML format.
Reported by: | Otavio Salvador <otavio@…> | Owned by: | cmlenz |
---|---|---|---|
Priority: | major | Milestone: | 0.5 |
Component: | Recipe commands | Version: | 0.4 |
Keywords: | Cc: | ||
Operating System: |
Description
Current Bitten code has its own unittest code to export the unittests results to XML. Would be good if we have a replacement, mostly like trace.py python module, to be able to use and grab it's results without the need of code it specifically to integrate with bitten.
Attachments (0)
Change History (5)
comment:1 Changed 19 years ago by cmlenz
comment:2 Changed 19 years ago by cmlenz
Also, it'd be nice if <python:unittest> was able to parse the standard verbose output of unittest. That will take some trickery to extrapolate the file names from the names of the test cases, but it should be possible to capture most of the info currently captured by the XML test results.
comment:3 Changed 19 years ago by cmlenz
- Status changed from new to assigned
In [230] I added a command-line interface to the bitten.util.testrunner so that it can now be used in a standalone fashion.
comment:4 Changed 19 years ago by Otavio Salvador <otavio@…>
I tried to use it and it fail.
Bellow you can see the log:
[DEBUG ] Executing <function exec_ at 0xb7a32b8c> with arguments: {'args': '-d build/coverage -s build/coverage.txt -o build/test-results.xml tests.tests', 'module': 'bitten.util.testrunner'} [DEBUG ] Executing ['python', '/usr/lib/python2.3/site-packages/Bitten-0.5dev_r230-py2.3.egg/bitten/util/testrunner.py', '-d', 'build/coverage', '-s', 'build/coverage.txt', '-o', 'build/test-results.xml', 'tests.tests'] [ERROR ] python: can't open file '/usr/lib/python2.3/site-packages/Bitten-0.5dev_r230-py2.3.egg/bitten/util/testrunner.py' [DEBUG ] python exited with code 512 [DEBUG ] Executing <function trace at 0xb7a32c34> with arguments: {'exclude': '*.tests.*', 'include': 'cdd*', 'coverdir': 'build/coverage', 'summary': 'build/coverage.txt'} [WARNING ] Error opening coverage summary file ([Errno 2] No such file or directory: '/tmp/bittenXi8kMM/trunk_r111/build/coverage.txt') [ERROR ] Build step test failed [WARNING ] Build step test failed
comment:5 Changed 19 years ago by cmlenz
- Resolution set to fixed
- Status changed from assigned to closed
That error is due to the script bitten/util/testrunner.py being packaged in an egg. Thus the script does not map to an actual file on the file system, and cannot be run this way.
As a workaround, I've added a function attribute to the <python:exec> command in [253].
Now you can use the following declaration:
<python:exec module="bitten.util.testrunner" function="main" output="build/test-results.xml" args="--xml-results build/test-results.xml --coverage-summary build/coverage.txt --coverage-dir build/coverage tests.tests" />
Actually, the unittest distutils command (from bitten.util.testrunner) is not specific to Bitten. It is, however, specific to distutils, and cannot be easily used standalone. This should be fixable, though.