Skip to content
Permalink
Browse files

Handled malformed xml generated by Doxygen for QgsDocCoverage test

  • Loading branch information
nyalldawson committed Jun 18, 2015
1 parent 6deb520 commit 075d6f2ad51abc52759d28ee86235a1dace568f9
Showing with 20 additions and 9 deletions.
  1. +20 −9 tests/src/python/test_qgsdoccoverage.py
@@ -86,15 +86,26 @@ def parseClassElem(e):
def parseFile(f):
documentable_members = 0
documented_members = 0
for event, elem in ET.iterparse(f):
if event == 'end' and elem.tag == 'compounddef':
if elemIsDocumentableClass(elem):
members, documented = parseClassElem(elem)
documentable_members += members
documented_members += documented
if documented < members:
print "Class {}, {}/{} members documented".format(elem.find('compoundname').text,documented,members)
elem.clear()
try:
for event, elem in ET.iterparse(f):
if event == 'end' and elem.tag == 'compounddef':
if elemIsDocumentableClass(elem):
members, documented = parseClassElem(elem)
documentable_members += members
documented_members += documented
if documented < members:
print "Class {}, {}/{} members documented".format(elem.find('compoundname').text,documented,members)
elem.clear()
except ET.ParseError as e:
#sometimes Doxygen generates malformed xml (eg for < and > operators)
line_num, col = e.position
with open(f, 'r') as xml_file:
for i, l in enumerate(xml_file):
if i == line_num - 1:
line = l
break
caret = '{:=>{}}'.format('^', col )
print 'ParseError in {}\n{}\n{}\n{}'.format(f,e,line,caret)
return documentable_members, documented_members


0 comments on commit 075d6f2

Please sign in to comment.
You can’t perform that action at this time.