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

Side by Side Diff: third_party/twisted_8_1/twisted/trial/test/suppression.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # -*- test-case-name: twisted.trial.test.test_tests -*-
2
3 import warnings
4
5 from twisted.trial import unittest, util
6
7
8 """ test to make sure that warning supression works at the module, method, and
9 class levels
10 """
11
12 METHOD_WARNING_MSG = "method warning message"
13 CLASS_WARNING_MSG = "class warning message"
14 MODULE_WARNING_MSG = "module warning message"
15
16 class MethodWarning(Warning):
17 pass
18
19 class ClassWarning(Warning):
20 pass
21
22 class ModuleWarning(Warning):
23 pass
24
25 class EmitMixin:
26 __counter = 0
27
28 def _emit(self):
29 warnings.warn(METHOD_WARNING_MSG + '_%s' % (EmitMixin.__counter), Method Warning)
30 warnings.warn(CLASS_WARNING_MSG + '_%s' % (EmitMixin.__counter), ClassWa rning)
31 warnings.warn(MODULE_WARNING_MSG + '_%s' % (EmitMixin.__counter), Module Warning)
32 EmitMixin.__counter += 1
33
34
35 class TestSuppression(unittest.TestCase, EmitMixin):
36 def testSuppressMethod(self):
37 self._emit()
38 testSuppressMethod.suppress = [util.suppress(message=METHOD_WARNING_MSG)]
39
40 def testSuppressClass(self):
41 self._emit()
42
43 def testOverrideSuppressClass(self):
44 self._emit()
45 testOverrideSuppressClass.suppress = []
46
47 TestSuppression.suppress = [util.suppress(message=CLASS_WARNING_MSG)]
48
49
50 class TestSuppression2(unittest.TestCase, EmitMixin):
51 def testSuppressModule(self):
52 self._emit()
53
54 suppress = [util.suppress(message=MODULE_WARNING_MSG)]
55
56
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698