Skip to content
Permalink
Browse files

Write important test output to travis console

  • Loading branch information
m-kuhn committed Sep 14, 2015
1 parent 76ccf71 commit b8b760e2bb72311a557cf13150f22efb000f373f
@@ -41,3 +41,5 @@ before_script:
script:
- ./ci/travis/${TRAVIS_OS_NAME}/script.sh

after_script:
- ./ci/travis/${TRAVIS_OS_NAME}/after_script.sh
@@ -0,0 +1 @@
cat '/tmp/ctest-important.log'
No changes.
@@ -16,7 +16,8 @@
import glob

from utilities import (TestCase,
unittest)
unittest,
printImportant)

try:
import xml.etree.cElementTree as ET
@@ -39,7 +40,7 @@ def elemIsDocumentableClass(elem):
if not elem.get('kind') == 'class':
return False

#public or protected classes should be documented
# public or protected classes should be documented
return elem.get('prot') in ('public', 'protected')


@@ -58,27 +59,27 @@ def elemIsDocumentableMember(elem):
if elem.get('kind') == 'variable':
return False

#only public or protected members should be documented
# only public or protected members should be documented
if not elem.get('prot') in ('public', 'protected'):
return False

#ignore reimplemented methods
#use two different tests, as doxygen will not detect reimplemented qt methods
# ignore reimplemented methods
# use two different tests, as doxygen will not detect reimplemented qt methods
if elem.find('reimplements') is not None:
return False
args = elem.find('argsstring')
if args is not None and args.text and ' override' in args.text:
return False

#ignore destructor
# ignore destructor
name = elem.find('name')
try:
if name.text and name.text.startswith('~'):
return False
except:
pass

#ignore constructors with no arguments
# ignore constructors with no arguments
definition = elem.find('definition')
argsstring = elem.find('argsstring')
try:
@@ -87,21 +88,21 @@ def elemIsDocumentableMember(elem):
except:
pass

#ignore certain obvious operators
# ignore certain obvious operators
try:
if name.text in ('operator=', 'operator=='):
return False
except:
pass

#ignore on_* slots
# ignore on_* slots
try:
if name.text.startswith('on_'):
return False
except:
pass

#ignore deprecated members
# ignore deprecated members
typeelem = elem.find('type')
try:
if typeelem.text and 'Q_DECL_DEPRECATED' in typeelem.text:
@@ -151,7 +152,7 @@ def parseFile(f):
print "\n"
elem.clear()
except ET.ParseError as e:
#sometimes Doxygen generates malformed xml (eg for < and > operators)
# 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):
@@ -186,11 +187,11 @@ def testCoverage(self):
missing = documentable - documented

print "---------------------------------"
print "{} total documentable members".format(documentable)
print "{} total contain valid documentation".format(documented)
print "Total documentation coverage {}%".format(coverage)
print "---------------------------------"
print "{} members missing documentation, out of {} allowed".format(missing, ACCEPTABLE_MISSING_DOCS)
printImportant("{} total documentable members".format(documentable))
printImportant("{} total contain valid documentation".format(documented))
printImportant("Total documentation coverage {}%".format(coverage))
printImportant("---------------------------------")
printImportant("{} members missing documentation, out of {} allowed".format(missing, ACCEPTABLE_MISSING_DOCS))

assert missing <= ACCEPTABLE_MISSING_DOCS, 'FAIL: new undocumented members have been introduced, please add documentation for these members'

@@ -174,7 +174,7 @@ def setCanvasCrs(theEpsgId, theOtfpFlag=False):

# Create CRS Instance
myCrs = QgsCoordinateReferenceSystem()
myCrs.createFromId(theEpsgId, QgsCoordinateReferenceSystem.EpsgCrsId)
myCrs.createFromId(theEpsgId, QgsCoordinateReferenceSystem.E)

# Reproject all layers to WGS84 geographic CRS
CANVAS.mapRenderer().setDestinationCrs(myCrs)
@@ -361,3 +361,15 @@ def openInBrowserTab(url):
subprocess.Popen([sys.executable, "-c", cmd],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)


def printImportant(info):
"""
Prints important information to stdout and to a file which in the end
should be printed on test result pages.
:param info: A string to print
"""

print(info)
with open(os.path.join(tempfile.gettempdir(), 'ctest-important.log'), 'a+') as f:
f.write(u'{}\n'.format(info))

0 comments on commit b8b760e

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