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

Side by Side Diff: third_party/twisted_8_1/twisted/trial/itrial.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 """
2 Interfaces for Trial.
3 """
4
5 # Copyright (c) 2001-2007 Twisted Matrix Laboratories.
6 # See LICENSE for details.
7 # Maintainer: Jonathan Lange <jml@twistedmatrix.com>
8
9 import zope.interface as zi
10 from zope.interface import Attribute
11
12
13 class ITestCase(zi.Interface):
14 """
15 The interface that a test case must implement in order to be used in Trial.
16 """
17
18 failureException = zi.Attribute(
19 "The exception class that is raised by failed assertions")
20
21
22 def __call__(result):
23 """
24 Run the test. Should always do exactly the same thing as run().
25 """
26
27
28 def countTestCases():
29 """
30 Return the number of tests in this test case. Usually 1.
31 """
32
33
34 def id():
35 """
36 Return a unique identifier for the test, usually the fully-qualified
37 Python name.
38 """
39
40
41 def run(result):
42 """
43 Run the test, storing the results in C{result}.
44
45 @param result: A L{TestResult}.
46 """
47
48
49 def shortDescription():
50 """
51 Return a short description of the test.
52 """
53
54
55
56 class IReporter(zi.Interface):
57 """
58 I report results from a run of a test suite.
59 """
60
61 stream = zi.Attribute(
62 "Deprecated in Twisted 8.0. "
63 "The io-stream that this reporter will write to")
64 tbformat = zi.Attribute("Either 'default', 'brief', or 'verbose'")
65 args = zi.Attribute(
66 "Additional string argument passed from the command line")
67 shouldStop = zi.Attribute(
68 """
69 A boolean indicating that this reporter would like the test run to stop.
70 """)
71 separator = Attribute(
72 "Deprecated in Twisted 8.0. "
73 "A value which will occasionally be passed to the L{write} method.")
74 testsRun = Attribute(
75 """
76 The number of tests that seem to have been run according to this
77 reporter.
78 """)
79
80
81 def startTest(method):
82 """
83 Report the beginning of a run of a single test method.
84
85 @param method: an object that is adaptable to ITestMethod
86 """
87
88
89 def stopTest(method):
90 """
91 Report the status of a single test method
92
93 @param method: an object that is adaptable to ITestMethod
94 """
95
96
97 def startSuite(name):
98 """
99 Deprecated in Twisted 8.0.
100
101 Suites which wish to appear in reporter output should call this
102 before running their tests.
103 """
104
105
106 def endSuite(name):
107 """
108 Deprecated in Twisted 8.0.
109
110 Called at the end of a suite, if and only if that suite has called
111 C{startSuite}.
112 """
113
114
115 def cleanupErrors(errs):
116 """
117 Deprecated in Twisted 8.0.
118
119 Called when the reactor has been left in a 'dirty' state
120
121 @param errs: a list of L{twisted.python.failure.Failure}s
122 """
123
124
125 def upDownError(userMeth, warn=True, printStatus=True):
126 """
127 Deprecated in Twisted 8.0.
128
129 Called when an error occurs in a setUp* or tearDown* method
130
131 @param warn: indicates whether or not the reporter should emit a
132 warning about the error
133 @type warn: Boolean
134 @param printStatus: indicates whether or not the reporter should
135 print the name of the method and the status
136 message appropriate for the type of error
137 @type printStatus: Boolean
138 """
139
140
141 def addSuccess(test):
142 """
143 Record that test passed.
144 """
145
146
147 def addError(test, error):
148 """
149 Record that a test has raised an unexpected exception.
150
151 @param test: The test that has raised an error.
152 @param error: The error that the test raised. It will either be a
153 three-tuple in the style of C{sys.exc_info()} or a
154 L{Failure<twisted.python.failure.Failure>} object.
155 """
156
157
158 def addFailure(test, failure):
159 """
160 Record that a test has failed with the given failure.
161
162 @param test: The test that has failed.
163 @param failure: The failure that the test failed with. It will
164 either be a three-tuple in the style of C{sys.exc_info()}
165 or a L{Failure<twisted.python.failure.Failure>} object.
166 """
167
168
169 def addExpectedFailure(test, failure, todo):
170 """
171 Record that the given test failed, and was expected to do so.
172
173 @type test: L{pyunit.TestCase}
174 @param test: The test which this is about.
175 @type error: L{failure.Failure}
176 @param error: The error which this test failed with.
177 @type todo: L{unittest.Todo}
178 @param todo: The reason for the test's TODO status.
179 """
180
181
182 def addUnexpectedSuccess(test, todo):
183 """
184 Record that the given test failed, and was expected to do so.
185
186 @type test: L{pyunit.TestCase}
187 @param test: The test which this is about.
188 @type todo: L{unittest.Todo}
189 @param todo: The reason for the test's TODO status.
190 """
191
192
193 def addSkip(test, reason):
194 """
195 Record that a test has been skipped for the given reason.
196
197 @param test: The test that has been skipped.
198 @param reason: An object that the test case has specified as the reason
199 for skipping the test.
200 """
201
202
203 def printSummary():
204 """
205 Deprecated in Twisted 8.0, use L{done} instead.
206
207 Present a summary of the test results.
208 """
209
210
211 def printErrors():
212 """
213 Deprecated in Twisted 8.0, use L{done} instead.
214
215 Present the errors that have occured during the test run. This method
216 will be called after all tests have been run.
217 """
218
219
220 def write(string):
221 """
222 Deprecated in Twisted 8.0, use L{done} instead.
223
224 Display a string to the user, without appending a new line.
225 """
226
227
228 def writeln(string):
229 """
230 Deprecated in Twisted 8.0, use L{done} instead.
231
232 Display a string to the user, appending a new line.
233 """
234
235 def wasSuccessful():
236 """
237 Return a boolean indicating whether all test results that were reported
238 to this reporter were successful or not.
239 """
240
241
242 def done():
243 """
244 Called when the test run is complete.
245
246 This gives the result object an opportunity to display a summary of
247 information to the user. Once you have called C{done} on an
248 L{IReporter} object, you should assume that the L{IReporter} object is
249 no longer usable.
250 """
OLDNEW
« no previous file with comments | « third_party/twisted_8_1/twisted/trial/__init__.py ('k') | third_party/twisted_8_1/twisted/trial/reporter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698