Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Unified Diff: scripts/master/unittests/exception_notifier_test.py

Issue 720273003: ExceptionNotifier: a new MailNotifier which treats exceptions as failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressed comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « scripts/master/exception_notifier.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/master/unittests/exception_notifier_test.py
diff --git a/scripts/master/unittests/exception_notifier_test.py b/scripts/master/unittests/exception_notifier_test.py
new file mode 100755
index 0000000000000000000000000000000000000000..a74802c9026a9f6b55e9169e8ae5a496ce1b47db
--- /dev/null
+++ b/scripts/master/unittests/exception_notifier_test.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""ExceptionNofifier unittests."""
+
+import unittest
+
+import test_env # pylint: disable=W0611
+
+from buildbot.status import results
+from master import exception_notifier
+
+
+class BuildMock(object):
+ # Silence Method could be a function: pylint: disable=R0201
+ def getBuilder(self):
+ return None
+
+
+class ExceptionNotifierTest(unittest.TestCase):
+ def test_mode_failing(self):
+ notifier = exception_notifier.ExceptionNotifier(
+ fromaddr='buildbot@test',
+ mode='failing',
+ )
+ self.assertTrue(notifier)
+ self.assertTrue(notifier.isMailNeeded(BuildMock(), results.EXCEPTION))
+ self.assertTrue(notifier.isMailNeeded(BuildMock(), results.FAILURE))
+ self.assertFalse(notifier.isMailNeeded(BuildMock(), results.SUCCESS))
+
+
+if __name__ == '__main__':
+ unittest.main()
« no previous file with comments | « scripts/master/exception_notifier.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698