0
|
1 import sys
|
|
2 from nose.plugins.base import Plugin
|
|
3
|
|
4 from StringIO import StringIO
|
|
5
|
|
6 import pygtk
|
|
7 pygtk.require('2.0')
|
|
8 import pynotify
|
|
9 from new import instancemethod
|
|
10
|
|
11 def writeln(self,*args):
|
|
12 for i in args:
|
|
13 self.write(i)
|
|
14 self.write("\n")
|
|
15
|
|
16 class NotifyPlugin(Plugin):
|
|
17
|
|
18 enabled = True
|
|
19 score = 1000
|
|
20 name = "NotifyPlugin"
|
|
21
|
|
22 def __init__(self):
|
|
23 self.stdout = []
|
|
24 self._buf = StringIO()
|
|
25 self._buf.writeln = instancemethod(writeln,self._buf,StringIO)
|
|
26
|
|
27 def configure(self, options, conf):
|
|
28 pass
|
|
29
|
|
30 def options(self, parser, env):
|
|
31 pass
|
|
32
|
|
33 def finalize(self, result):
|
|
34 result.stream = self._buf
|
|
35 result.printSummary(0,2)
|
|
36 pynotify.init("Basics")
|
|
37 n = pynotify.Notification("Tests", self._buf.getvalue())
|
|
38 n.show()
|
|
39 return None |