Skip to content

Commit 7ec82c3

Browse files
committed
Add tests for HTML and XML reports
1 parent deb4412 commit 7ec82c3

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/plugin_test.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,28 @@ def get_analysis(self, name=None):
115115
_, executable, _, missing, _ = analysis
116116
return executable, missing
117117

118+
def get_html_report(self, name=None):
119+
"""Get the html report for a template.
120+
121+
Returns:
122+
float: the total percentage covered.
123+
124+
"""
125+
path = self.path(name)
126+
html_coverage = self.cov.html_report(os.path.abspath(path))
127+
return html_coverage
128+
129+
def get_xml_report(self, name=None):
130+
"""Get the xml report for a template.
131+
132+
Returns:
133+
float: the total percentage covered.
134+
135+
"""
136+
path = self.path(name)
137+
xml_coverage = self.cov.xml_report(os.path.abspath(path))
138+
return xml_coverage
139+
118140

119141
def squashed(s):
120142
"""Remove all of the whitespace from s."""

tests/test_simple.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ def test_non_ascii(self):
6666
self.assertEqual(text, u'υηιcσɗє ιѕ тяιcку\nɘboɔinU!\n')
6767
self.assertEqual(self.get_line_data(), [1, 2])
6868
self.assertEqual(self.get_analysis(), ([1, 2], []))
69+
self.assertEqual(self.get_html_report(), 100)
70+
self.assertEqual(self.get_xml_report(), 100)
6971

7072

7173
class CommentTest(DjangoPluginTestCase):

0 commit comments

Comments
 (0)