Skip to content

Instantly share code, notes, and snippets.

@yoshiori
Created October 8, 2011 11:58
Show Gist options
  • Select an option

  • Save yoshiori/1272189 to your computer and use it in GitHub Desktop.

Select an option

Save yoshiori/1272189 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gntp.notifier
import sys
applicationIcon = 'http://cdn-ak.f.st-hatena.com/images/fotolife/k/kompiro/20100811/20100811151901.png'
notifications = ['OK','Failure','Error']
okIcon = 'https://github.com/kompiro/quick-junit/blob/master/junit.extensions.eclipse.quick.notifications/icons/tsuiteok.gif?raw=true'
failIcon = 'https://github.com/kompiro/quick-junit/raw/master/junit.extensions.eclipse.quick.notifications/icons/tsuitefail.gif'
errorIcon = 'https://github.com/kompiro/quick-junit/blob/master/junit.extensions.eclipse.quick.notifications/icons/tsuiteerror.gif?raw=true'
growl = gntp.notifier.GrowlNotifier(
applicationName = 'QuickJUnitGrowlNotifir.py',
notifications = notifications,
defaultNotifications = notifications,
applicationIcon = applicationIcon,
)
growl.register()
if __name__ == '__main__':
argvs = sys.argv
argc = len(argvs)
if argc != 2 :
print '''Usage: # python %s QuickJunitDetail
template is ${results},${name},${error_counts},${fail_counts},${ok_counts},${total_counts}
''' % argvs[0]
quit()
results = argvs[1].strip('"').split(',')
description = 'OK:%s FAIL:%s ERROR:%s TOTAL:%s' % tuple(results[2:])
noteType = results[0]
icon = okIcon
if noteType == 'Failure':
icon = failIcon
elif noteType == 'Error':
icon = errorIcon
growl.notify(
noteType = noteType,
title = results[1],
description = description,
icon = icon,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment