Adding support for the Python coverage.py tool.

This assumes that coverage.py has been run in such a way to produce its
standard XML output. This uses the Cobertura schema and should be somewhat
generalizable.
This commit is contained in:
Patrick Reynolds
2013-09-27 10:42:39 -04:00
committed by Brad King
parent 6ed8504ea5
commit d0ec3a01a6
10 changed files with 281 additions and 0 deletions
@@ -0,0 +1,8 @@
# This file is configured by CMake automatically as DartConfiguration.tcl
# If you choose not to use CMake, this file may be hand configured, by
# filling in the required variables.
# Configuration directories and files
SourceDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage/coveragetest
BuildDirectory: ${CMake_BINARY_DIR}/Testing/PythonCoverage
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<!DOCTYPE coverage
SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
<coverage branch-rate="0" line-rate="0.8462" timestamp="1380469411433" version="3.6">
<!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
<packages>
<package branch-rate="0" complexity="0" line-rate="0.8462" name="">
<classes>
<class branch-rate="0" complexity="0" filename="foo.py" line-rate="0.6667" name="foo">
<methods/>
<lines>
<line hits="1" number="2"/>
<line hits="1" number="3"/>
<line hits="1" number="4"/>
<line hits="1" number="6"/>
<line hits="0" number="7"/>
<line hits="0" number="8"/>
</lines>
</class>
<class branch-rate="0" complexity="0" filename="test_foo.py" line-rate="1" name="test_foo">
<methods/>
<lines>
<line hits="1" number="2"/>
<line hits="1" number="3"/>
<line hits="1" number="5"/>
<line hits="1" number="7"/>
<line hits="1" number="8"/>
<line hits="1" number="10"/>
<line hits="1" number="11"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
+8
View File
@@ -0,0 +1,8 @@
def foo():
x = 3 + 3
return x
def bar():
y = 2 + 2
return y
@@ -0,0 +1,11 @@
import foo
import unittest
class TestFoo(unittest.TestCase):
def testFoo(self):
self.assertEquals(foo.foo(), 6, 'foo() == 6')
if __name__ == '__main__':
unittest.main()