Skip to content
Permalink
Browse files

Fix sip coverage test detection of member variables

  • Loading branch information
nyalldawson committed Nov 9, 2015
1 parent a0542e5 commit da627e9b90290cf4aee7d17c3d4dde000ef9c6a3
Showing with 19 additions and 3 deletions.
  1. +19 −3 tests/src/python/test_qgssipcoverage.py
@@ -55,7 +55,10 @@ def testCoverage(self):
bound_objects = {}
for o in objects:
try:
bound_objects[o] = globals()[o]
if '::' in o:
bound_objects[o] = getattr(globals()[o.split('::')[0]], o.split('::')[1])
else:
bound_objects[o] = globals()[o]
except:
missing_objects.append(o)

@@ -67,8 +70,21 @@ def testCoverage(self):
for m in parser.bindable_members:
if m[0] in bound_objects:
obj = bound_objects[m[0]]
if not hasattr(obj, m[1]):
missing_members.append('{}.{}'.format(m[0], m[1]))

#try two different methods of checking for member existence
try:
if hasattr(obj, m[1]):
continue
except:
pass

try:
if m[1] in dir(obj):
continue
except:
printImportant("SIP coverage test: something strange happened in {}.{}, obj={}".format(m[0], m[1], obj))

missing_members.append('{}.{}'.format(m[0], m[1]))

missing_members.sort()

0 comments on commit da627e9

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