Skip to content

Commit b8b760e

Browse files
committedSep 14, 2015
Write important test output to travis console
1 parent 76ccf71 commit b8b760e

File tree

5 files changed

+33
-17
lines changed

5 files changed

+33
-17
lines changed
 

‎.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ before_script:
4141
script:
4242
- ./ci/travis/${TRAVIS_OS_NAME}/script.sh
4343

44+
after_script:
45+
- ./ci/travis/${TRAVIS_OS_NAME}/after_script.sh

‎ci/travis/linux/after_script.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cat '/tmp/ctest-important.log'

‎ci/travis/osx/after_script.sh

Whitespace-only changes.

‎tests/src/python/test_qgsdoccoverage.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
import glob
1717

1818
from utilities import (TestCase,
19-
unittest)
19+
unittest,
20+
printImportant)
2021

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

42-
#public or protected classes should be documented
43+
# public or protected classes should be documented
4344
return elem.get('prot') in ('public', 'protected')
4445

4546

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

61-
#only public or protected members should be documented
62+
# only public or protected members should be documented
6263
if not elem.get('prot') in ('public', 'protected'):
6364
return False
6465

65-
#ignore reimplemented methods
66-
#use two different tests, as doxygen will not detect reimplemented qt methods
66+
# ignore reimplemented methods
67+
# use two different tests, as doxygen will not detect reimplemented qt methods
6768
if elem.find('reimplements') is not None:
6869
return False
6970
args = elem.find('argsstring')
7071
if args is not None and args.text and ' override' in args.text:
7172
return False
7273

73-
#ignore destructor
74+
# ignore destructor
7475
name = elem.find('name')
7576
try:
7677
if name.text and name.text.startswith('~'):
7778
return False
7879
except:
7980
pass
8081

81-
#ignore constructors with no arguments
82+
# ignore constructors with no arguments
8283
definition = elem.find('definition')
8384
argsstring = elem.find('argsstring')
8485
try:
@@ -87,21 +88,21 @@ def elemIsDocumentableMember(elem):
8788
except:
8889
pass
8990

90-
#ignore certain obvious operators
91+
# ignore certain obvious operators
9192
try:
9293
if name.text in ('operator=', 'operator=='):
9394
return False
9495
except:
9596
pass
9697

97-
#ignore on_* slots
98+
# ignore on_* slots
9899
try:
99100
if name.text.startswith('on_'):
100101
return False
101102
except:
102103
pass
103104

104-
#ignore deprecated members
105+
# ignore deprecated members
105106
typeelem = elem.find('type')
106107
try:
107108
if typeelem.text and 'Q_DECL_DEPRECATED' in typeelem.text:
@@ -151,7 +152,7 @@ def parseFile(f):
151152
print "\n"
152153
elem.clear()
153154
except ET.ParseError as e:
154-
#sometimes Doxygen generates malformed xml (eg for < and > operators)
155+
# sometimes Doxygen generates malformed xml (eg for < and > operators)
155156
line_num, col = e.position
156157
with open(f, 'r') as xml_file:
157158
for i, l in enumerate(xml_file):
@@ -186,11 +187,11 @@ def testCoverage(self):
186187
missing = documentable - documented
187188

188189
print "---------------------------------"
189-
print "{} total documentable members".format(documentable)
190-
print "{} total contain valid documentation".format(documented)
191-
print "Total documentation coverage {}%".format(coverage)
192-
print "---------------------------------"
193-
print "{} members missing documentation, out of {} allowed".format(missing, ACCEPTABLE_MISSING_DOCS)
190+
printImportant("{} total documentable members".format(documentable))
191+
printImportant("{} total contain valid documentation".format(documented))
192+
printImportant("Total documentation coverage {}%".format(coverage))
193+
printImportant("---------------------------------")
194+
printImportant("{} members missing documentation, out of {} allowed".format(missing, ACCEPTABLE_MISSING_DOCS))
194195

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

‎tests/src/python/utilities.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def setCanvasCrs(theEpsgId, theOtfpFlag=False):
174174

175175
# Create CRS Instance
176176
myCrs = QgsCoordinateReferenceSystem()
177-
myCrs.createFromId(theEpsgId, QgsCoordinateReferenceSystem.EpsgCrsId)
177+
myCrs.createFromId(theEpsgId, QgsCoordinateReferenceSystem.E)
178178

179179
# Reproject all layers to WGS84 geographic CRS
180180
CANVAS.mapRenderer().setDestinationCrs(myCrs)
@@ -361,3 +361,15 @@ def openInBrowserTab(url):
361361
subprocess.Popen([sys.executable, "-c", cmd],
362362
stdout=subprocess.PIPE,
363363
stderr=subprocess.STDOUT)
364+
365+
366+
def printImportant(info):
367+
"""
368+
Prints important information to stdout and to a file which in the end
369+
should be printed on test result pages.
370+
:param info: A string to print
371+
"""
372+
373+
print(info)
374+
with open(os.path.join(tempfile.gettempdir(), 'ctest-important.log'), 'a+') as f:
375+
f.write(u'{}\n'.format(info))

0 commit comments

Comments
 (0)
Please sign in to comment.