annotate notify_test.py @ 0:f625999d7c09 v0.1

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