librpc: Shorten dcerpc_binding_handle_call a bit
[Samba/bjacke.git] / lib / subunit / filters / subunit-notify
blob8cce2d16096b3f433d103fac9a4a9f3dc8c4c02f
1 #!/usr/bin/env python
2 # subunit: extensions to python unittest to get test results from subprocesses.
3 # Copyright (C) 2010 Jelmer Vernooij <jelmer@samba.org>
5 # Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
6 # license at the users choice. A copy of both licenses are available in the
7 # project source as Apache-2.0 and BSD. You may not use this file except in
8 # compliance with one of these two licences.
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # license you chose for the specific language governing permissions and
14 # limitations under that license.
17 """Notify the user of a finished test run."""
19 import pygtk
20 pygtk.require('2.0')
21 import pynotify
23 from subunit import TestResultStats
24 from subunit.filters import run_filter_script
26 if not pynotify.init("Subunit-notify"):
27 sys.exit(1)
30 def notify_of_result(result):
31 if result.failed_tests > 0:
32 summary = "Test run failed"
33 else:
34 summary = "Test run successful"
35 body = "Total tests: %d; Passed: %d; Failed: %d" % (
36 result.total_tests,
37 result.passed_tests,
38 result.failed_tests,
40 nw = pynotify.Notification(summary, body)
41 nw.show()
44 run_filter_script(TestResultStats, __doc__, notify_of_result)