# NOTE: Please do not edit this file directly
# Create your custom qualifications in the 'ext' folder

result = {}

if events:
    result = {'success': True}
    failures = filter(lambda ev: ev.type == 'functionalResult' and ev.get('result') != 'PASSED', events)
    if failures:
        result['success'] = False
        result['reason'] = '%d test%s failed' % (len(failures), len(failures) > 1 and 's' or '')

resultHolder.setResult(result)