summaryrefslogtreecommitdiffstats
path: root/Tests/PythonCoverage/coveragetest
diff options
context:
space:
mode:
authorPatrick Reynolds <patrick.reynolds@kitware.com>2013-09-27 14:42:39 (GMT)
committerBrad King <brad.king@kitware.com>2013-10-08 13:20:30 (GMT)
commitd0ec3a01a61f259768d31fc20791780807e1788e (patch)
treed5dfba622c1739ddedadfe7190eda5c7959a27f5 /Tests/PythonCoverage/coveragetest
parent6ed8504ea5633932e5db3a5a70853a763df7af50 (diff)
downloadCMake-d0ec3a01a61f259768d31fc20791780807e1788e.zip
CMake-d0ec3a01a61f259768d31fc20791780807e1788e.tar.gz
CMake-d0ec3a01a61f259768d31fc20791780807e1788e.tar.bz2
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.
Diffstat (limited to 'Tests/PythonCoverage/coveragetest')
-rw-r--r--Tests/PythonCoverage/coveragetest/foo.py8
-rw-r--r--Tests/PythonCoverage/coveragetest/test_foo.py11
2 files changed, 19 insertions, 0 deletions
diff --git a/Tests/PythonCoverage/coveragetest/foo.py b/Tests/PythonCoverage/coveragetest/foo.py
new file mode 100644
index 0000000..97b5a41
--- /dev/null
+++ b/Tests/PythonCoverage/coveragetest/foo.py
@@ -0,0 +1,8 @@
+
+def foo():
+ x = 3 + 3
+ return x
+
+def bar():
+ y = 2 + 2
+ return y
diff --git a/Tests/PythonCoverage/coveragetest/test_foo.py b/Tests/PythonCoverage/coveragetest/test_foo.py
new file mode 100644
index 0000000..51a69d8
--- /dev/null
+++ b/Tests/PythonCoverage/coveragetest/test_foo.py
@@ -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()