Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix sip coverage test detection of member variables
  • Loading branch information
nyalldawson committed Nov 10, 2015
1 parent a0542e5 commit da627e9
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/src/python/test_qgssipcoverage.py
Expand Up @@ -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)

Expand All @@ -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()

Expand Down

0 comments on commit da627e9

Please sign in to comment.