|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.PyUnit.UnittestDialog</title> |
|
6 <style> |
|
7 b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' |
|
8 </style> |
|
9 </head> |
|
10 <body><a NAME="top" ID="top"></a> |
|
11 <h1>eric5.PyUnit.UnittestDialog</h1> |
|
12 <p> |
|
13 Module implementing the UI to the pyunit package. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#QtTestResult">QtTestResult</a></td> |
|
23 <td>A TestResult derivative to work with a graphical GUI.</td> |
|
24 </tr><tr> |
|
25 <td><a href="#UnittestDialog">UnittestDialog</a></td> |
|
26 <td>Class implementing the UI to the pyunit package.</td> |
|
27 </tr><tr> |
|
28 <td><a href="#UnittestWindow">UnittestWindow</a></td> |
|
29 <td>Main window class for the standalone dialog.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 <table> |
|
34 <tr><td>None</td></tr> |
|
35 </table> |
|
36 <hr /><hr /> |
|
37 <a NAME="QtTestResult" ID="QtTestResult"></a> |
|
38 <h2>QtTestResult</h2> |
|
39 <p> |
|
40 A TestResult derivative to work with a graphical GUI. |
|
41 </p><p> |
|
42 For more details see pyunit.py of the standard python distribution. |
|
43 </p> |
|
44 <h3>Derived from</h3> |
|
45 unittest.TestResult |
|
46 <h3>Class Attributes</h3> |
|
47 <table> |
|
48 <tr><td>None</td></tr> |
|
49 </table> |
|
50 <h3>Methods</h3> |
|
51 <table> |
|
52 <tr> |
|
53 <td><a href="#QtTestResult.__init__">QtTestResult</a></td> |
|
54 <td>Constructor</td> |
|
55 </tr><tr> |
|
56 <td><a href="#QtTestResult.addError">addError</a></td> |
|
57 <td>Method called if a test errored.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#QtTestResult.addFailure">addFailure</a></td> |
|
60 <td>Method called if a test failed.</td> |
|
61 </tr><tr> |
|
62 <td><a href="#QtTestResult.startTest">startTest</a></td> |
|
63 <td>Method called at the start of a test.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#QtTestResult.stopTest">stopTest</a></td> |
|
66 <td>Method called at the end of a test.</td> |
|
67 </tr> |
|
68 </table> |
|
69 <a NAME="QtTestResult.__init__" ID="QtTestResult.__init__"></a> |
|
70 <h4>QtTestResult (Constructor)</h4> |
|
71 <b>QtTestResult</b>(<i>parent</i>) |
|
72 <p> |
|
73 Constructor |
|
74 </p><dl> |
|
75 <dt><i>parent</i></dt> |
|
76 <dd> |
|
77 The parent widget. |
|
78 </dd> |
|
79 </dl><a NAME="QtTestResult.addError" ID="QtTestResult.addError"></a> |
|
80 <h4>QtTestResult.addError</h4> |
|
81 <b>addError</b>(<i>test, err</i>) |
|
82 <p> |
|
83 Method called if a test errored. |
|
84 </p><dl> |
|
85 <dt><i>test</i></dt> |
|
86 <dd> |
|
87 Reference to the test object |
|
88 </dd><dt><i>err</i></dt> |
|
89 <dd> |
|
90 The error traceback |
|
91 </dd> |
|
92 </dl><a NAME="QtTestResult.addFailure" ID="QtTestResult.addFailure"></a> |
|
93 <h4>QtTestResult.addFailure</h4> |
|
94 <b>addFailure</b>(<i>test, err</i>) |
|
95 <p> |
|
96 Method called if a test failed. |
|
97 </p><dl> |
|
98 <dt><i>test</i></dt> |
|
99 <dd> |
|
100 Reference to the test object |
|
101 </dd><dt><i>err</i></dt> |
|
102 <dd> |
|
103 The error traceback |
|
104 </dd> |
|
105 </dl><a NAME="QtTestResult.startTest" ID="QtTestResult.startTest"></a> |
|
106 <h4>QtTestResult.startTest</h4> |
|
107 <b>startTest</b>(<i>test</i>) |
|
108 <p> |
|
109 Method called at the start of a test. |
|
110 </p><dl> |
|
111 <dt><i>test</i></dt> |
|
112 <dd> |
|
113 Reference to the test object |
|
114 </dd> |
|
115 </dl><a NAME="QtTestResult.stopTest" ID="QtTestResult.stopTest"></a> |
|
116 <h4>QtTestResult.stopTest</h4> |
|
117 <b>stopTest</b>(<i>test</i>) |
|
118 <p> |
|
119 Method called at the end of a test. |
|
120 </p><dl> |
|
121 <dt><i>test</i></dt> |
|
122 <dd> |
|
123 Reference to the test object |
|
124 </dd> |
|
125 </dl> |
|
126 <div align="right"><a href="#top">Up</a></div> |
|
127 <hr /><hr /> |
|
128 <a NAME="UnittestDialog" ID="UnittestDialog"></a> |
|
129 <h2>UnittestDialog</h2> |
|
130 <p> |
|
131 Class implementing the UI to the pyunit package. |
|
132 </p><h4>Signals</h4> |
|
133 <dl> |
|
134 <dt>unittestFile(string,int,int)</dt> |
|
135 <dd> |
|
136 emitted to show the source of a unittest file |
|
137 </dd> |
|
138 </dl> |
|
139 <h3>Derived from</h3> |
|
140 QWidget, Ui_UnittestDialog |
|
141 <h3>Class Attributes</h3> |
|
142 <table> |
|
143 <tr><td>None</td></tr> |
|
144 </table> |
|
145 <h3>Methods</h3> |
|
146 <table> |
|
147 <tr> |
|
148 <td><a href="#UnittestDialog.__init__">UnittestDialog</a></td> |
|
149 <td>Constructor</td> |
|
150 </tr><tr> |
|
151 <td><a href="#UnittestDialog.__UTPrepared">__UTPrepared</a></td> |
|
152 <td>Private slot to handle the utPrepared signal.</td> |
|
153 </tr><tr> |
|
154 <td><a href="#UnittestDialog.__setProgressColor">__setProgressColor</a></td> |
|
155 <td>Private methode to set the color of the progress color label.</td> |
|
156 </tr><tr> |
|
157 <td><a href="#UnittestDialog.__setRunningMode">__setRunningMode</a></td> |
|
158 <td>Private method to set the GUI in running mode.</td> |
|
159 </tr><tr> |
|
160 <td><a href="#UnittestDialog.__setStoppedMode">__setStoppedMode</a></td> |
|
161 <td>Private method to set the GUI in stopped mode.</td> |
|
162 </tr><tr> |
|
163 <td><a href="#UnittestDialog.__showSource">__showSource</a></td> |
|
164 <td>Private slot to show the source of a traceback in an eric5 editor.</td> |
|
165 </tr><tr> |
|
166 <td><a href="#UnittestDialog.insertProg">insertProg</a></td> |
|
167 <td>Public slot to insert the filename prog into the testsuiteComboBox object.</td> |
|
168 </tr><tr> |
|
169 <td><a href="#UnittestDialog.insertTestName">insertTestName</a></td> |
|
170 <td>Public slot to insert a test name into the testComboBox object.</td> |
|
171 </tr><tr> |
|
172 <td><a href="#UnittestDialog.on_buttonBox_clicked">on_buttonBox_clicked</a></td> |
|
173 <td>Private slot called by a button of the button box clicked.</td> |
|
174 </tr><tr> |
|
175 <td><a href="#UnittestDialog.on_errorsListWidget_currentTextChanged">on_errorsListWidget_currentTextChanged</a></td> |
|
176 <td>Private slot to handle the highlighted signal.</td> |
|
177 </tr><tr> |
|
178 <td><a href="#UnittestDialog.on_errorsListWidget_itemDoubleClicked">on_errorsListWidget_itemDoubleClicked</a></td> |
|
179 <td>Private slot called by doubleclicking an errorlist entry.</td> |
|
180 </tr><tr> |
|
181 <td><a href="#UnittestDialog.on_fileDialogButton_clicked">on_fileDialogButton_clicked</a></td> |
|
182 <td>Private slot to open a file dialog.</td> |
|
183 </tr><tr> |
|
184 <td><a href="#UnittestDialog.on_startButton_clicked">on_startButton_clicked</a></td> |
|
185 <td>Public slot to start the test.</td> |
|
186 </tr><tr> |
|
187 <td><a href="#UnittestDialog.on_stopButton_clicked">on_stopButton_clicked</a></td> |
|
188 <td>Private slot to stop the test.</td> |
|
189 </tr><tr> |
|
190 <td><a href="#UnittestDialog.on_testsuiteComboBox_editTextChanged">on_testsuiteComboBox_editTextChanged</a></td> |
|
191 <td>Private slot to handle changes of the test file name.</td> |
|
192 </tr><tr> |
|
193 <td><a href="#UnittestDialog.testErrored">testErrored</a></td> |
|
194 <td>Public method called if a test errors.</td> |
|
195 </tr><tr> |
|
196 <td><a href="#UnittestDialog.testFailed">testFailed</a></td> |
|
197 <td>Public method called if a test fails.</td> |
|
198 </tr><tr> |
|
199 <td><a href="#UnittestDialog.testFinished">testFinished</a></td> |
|
200 <td>Public method called if a test has finished.</td> |
|
201 </tr><tr> |
|
202 <td><a href="#UnittestDialog.testStarted">testStarted</a></td> |
|
203 <td>Public method called if a test is about to be run.</td> |
|
204 </tr> |
|
205 </table> |
|
206 <a NAME="UnittestDialog.__init__" ID="UnittestDialog.__init__"></a> |
|
207 <h4>UnittestDialog (Constructor)</h4> |
|
208 <b>UnittestDialog</b>(<i>prog = None, dbs = None, ui = None, parent = None, name = None</i>) |
|
209 <p> |
|
210 Constructor |
|
211 </p><dl> |
|
212 <dt><i>prog</i></dt> |
|
213 <dd> |
|
214 filename of the program to open |
|
215 </dd><dt><i>dbs</i></dt> |
|
216 <dd> |
|
217 reference to the debug server object. It is an indication |
|
218 whether we were called from within the eric5 IDE |
|
219 </dd><dt><i>ui</i></dt> |
|
220 <dd> |
|
221 reference to the UI object |
|
222 </dd><dt><i>parent</i></dt> |
|
223 <dd> |
|
224 parent widget of this dialog (QWidget) |
|
225 </dd><dt><i>name</i></dt> |
|
226 <dd> |
|
227 name of this dialog (string) |
|
228 </dd> |
|
229 </dl><a NAME="UnittestDialog.__UTPrepared" ID="UnittestDialog.__UTPrepared"></a> |
|
230 <h4>UnittestDialog.__UTPrepared</h4> |
|
231 <b>__UTPrepared</b>(<i>nrTests, exc_type, exc_value</i>) |
|
232 <p> |
|
233 Private slot to handle the utPrepared signal. |
|
234 </p><p> |
|
235 If the unittest suite was loaded successfully, we ask the |
|
236 client to run the test suite. |
|
237 </p><dl> |
|
238 <dt><i>nrTests</i></dt> |
|
239 <dd> |
|
240 number of tests contained in the test suite (integer) |
|
241 </dd><dt><i>exc_type</i></dt> |
|
242 <dd> |
|
243 type of exception occured during preparation (string) |
|
244 </dd><dt><i>exc_value</i></dt> |
|
245 <dd> |
|
246 value of exception occured during preparation (string) |
|
247 </dd> |
|
248 </dl><a NAME="UnittestDialog.__setProgressColor" ID="UnittestDialog.__setProgressColor"></a> |
|
249 <h4>UnittestDialog.__setProgressColor</h4> |
|
250 <b>__setProgressColor</b>(<i>color</i>) |
|
251 <p> |
|
252 Private methode to set the color of the progress color label. |
|
253 </p><dl> |
|
254 <dt><i>color</i></dt> |
|
255 <dd> |
|
256 colour to be shown (string) |
|
257 </dd> |
|
258 </dl><a NAME="UnittestDialog.__setRunningMode" ID="UnittestDialog.__setRunningMode"></a> |
|
259 <h4>UnittestDialog.__setRunningMode</h4> |
|
260 <b>__setRunningMode</b>(<i></i>) |
|
261 <p> |
|
262 Private method to set the GUI in running mode. |
|
263 </p><a NAME="UnittestDialog.__setStoppedMode" ID="UnittestDialog.__setStoppedMode"></a> |
|
264 <h4>UnittestDialog.__setStoppedMode</h4> |
|
265 <b>__setStoppedMode</b>(<i></i>) |
|
266 <p> |
|
267 Private method to set the GUI in stopped mode. |
|
268 </p><a NAME="UnittestDialog.__showSource" ID="UnittestDialog.__showSource"></a> |
|
269 <h4>UnittestDialog.__showSource</h4> |
|
270 <b>__showSource</b>(<i></i>) |
|
271 <p> |
|
272 Private slot to show the source of a traceback in an eric5 editor. |
|
273 </p><a NAME="UnittestDialog.insertProg" ID="UnittestDialog.insertProg"></a> |
|
274 <h4>UnittestDialog.insertProg</h4> |
|
275 <b>insertProg</b>(<i>prog</i>) |
|
276 <p> |
|
277 Public slot to insert the filename prog into the testsuiteComboBox object. |
|
278 </p><dl> |
|
279 <dt><i>prog</i></dt> |
|
280 <dd> |
|
281 filename to be inserted (string) |
|
282 </dd> |
|
283 </dl><a NAME="UnittestDialog.insertTestName" ID="UnittestDialog.insertTestName"></a> |
|
284 <h4>UnittestDialog.insertTestName</h4> |
|
285 <b>insertTestName</b>(<i>testName</i>) |
|
286 <p> |
|
287 Public slot to insert a test name into the testComboBox object. |
|
288 </p><dl> |
|
289 <dt><i>testName</i></dt> |
|
290 <dd> |
|
291 name of the test to be inserted (string) |
|
292 </dd> |
|
293 </dl><a NAME="UnittestDialog.on_buttonBox_clicked" ID="UnittestDialog.on_buttonBox_clicked"></a> |
|
294 <h4>UnittestDialog.on_buttonBox_clicked</h4> |
|
295 <b>on_buttonBox_clicked</b>(<i>button</i>) |
|
296 <p> |
|
297 Private slot called by a button of the button box clicked. |
|
298 </p><dl> |
|
299 <dt><i>button</i></dt> |
|
300 <dd> |
|
301 button that was clicked (QAbstractButton) |
|
302 </dd> |
|
303 </dl><a NAME="UnittestDialog.on_errorsListWidget_currentTextChanged" ID="UnittestDialog.on_errorsListWidget_currentTextChanged"></a> |
|
304 <h4>UnittestDialog.on_errorsListWidget_currentTextChanged</h4> |
|
305 <b>on_errorsListWidget_currentTextChanged</b>(<i>text</i>) |
|
306 <p> |
|
307 Private slot to handle the highlighted signal. |
|
308 </p><dl> |
|
309 <dt><i>txt</i></dt> |
|
310 <dd> |
|
311 current text (string) |
|
312 </dd> |
|
313 </dl><a NAME="UnittestDialog.on_errorsListWidget_itemDoubleClicked" ID="UnittestDialog.on_errorsListWidget_itemDoubleClicked"></a> |
|
314 <h4>UnittestDialog.on_errorsListWidget_itemDoubleClicked</h4> |
|
315 <b>on_errorsListWidget_itemDoubleClicked</b>(<i>lbitem</i>) |
|
316 <p> |
|
317 Private slot called by doubleclicking an errorlist entry. |
|
318 </p><p> |
|
319 It will popup a dialog showing the stacktrace. |
|
320 If called from eric, an additional button is displayed |
|
321 to show the python source in an eric source viewer (in |
|
322 erics main window. |
|
323 </p><dl> |
|
324 <dt><i>lbitem</i></dt> |
|
325 <dd> |
|
326 the listbox item that was double clicked |
|
327 </dd> |
|
328 </dl><a NAME="UnittestDialog.on_fileDialogButton_clicked" ID="UnittestDialog.on_fileDialogButton_clicked"></a> |
|
329 <h4>UnittestDialog.on_fileDialogButton_clicked</h4> |
|
330 <b>on_fileDialogButton_clicked</b>(<i></i>) |
|
331 <p> |
|
332 Private slot to open a file dialog. |
|
333 </p><a NAME="UnittestDialog.on_startButton_clicked" ID="UnittestDialog.on_startButton_clicked"></a> |
|
334 <h4>UnittestDialog.on_startButton_clicked</h4> |
|
335 <b>on_startButton_clicked</b>(<i></i>) |
|
336 <p> |
|
337 Public slot to start the test. |
|
338 </p><a NAME="UnittestDialog.on_stopButton_clicked" ID="UnittestDialog.on_stopButton_clicked"></a> |
|
339 <h4>UnittestDialog.on_stopButton_clicked</h4> |
|
340 <b>on_stopButton_clicked</b>(<i></i>) |
|
341 <p> |
|
342 Private slot to stop the test. |
|
343 </p><a NAME="UnittestDialog.on_testsuiteComboBox_editTextChanged" ID="UnittestDialog.on_testsuiteComboBox_editTextChanged"></a> |
|
344 <h4>UnittestDialog.on_testsuiteComboBox_editTextChanged</h4> |
|
345 <b>on_testsuiteComboBox_editTextChanged</b>(<i>txt</i>) |
|
346 <p> |
|
347 Private slot to handle changes of the test file name. |
|
348 </p><dl> |
|
349 <dt><i>txt</i></dt> |
|
350 <dd> |
|
351 name of the test file (string) |
|
352 </dd> |
|
353 </dl><a NAME="UnittestDialog.testErrored" ID="UnittestDialog.testErrored"></a> |
|
354 <h4>UnittestDialog.testErrored</h4> |
|
355 <b>testErrored</b>(<i>test, exc</i>) |
|
356 <p> |
|
357 Public method called if a test errors. |
|
358 </p><dl> |
|
359 <dt><i>test</i></dt> |
|
360 <dd> |
|
361 name of the failed test (string) |
|
362 </dd><dt><i>exc</i></dt> |
|
363 <dd> |
|
364 string representation of the exception (list of strings) |
|
365 </dd> |
|
366 </dl><a NAME="UnittestDialog.testFailed" ID="UnittestDialog.testFailed"></a> |
|
367 <h4>UnittestDialog.testFailed</h4> |
|
368 <b>testFailed</b>(<i>test, exc</i>) |
|
369 <p> |
|
370 Public method called if a test fails. |
|
371 </p><dl> |
|
372 <dt><i>test</i></dt> |
|
373 <dd> |
|
374 name of the failed test (string) |
|
375 </dd><dt><i>exc</i></dt> |
|
376 <dd> |
|
377 string representation of the exception (list of strings) |
|
378 </dd> |
|
379 </dl><a NAME="UnittestDialog.testFinished" ID="UnittestDialog.testFinished"></a> |
|
380 <h4>UnittestDialog.testFinished</h4> |
|
381 <b>testFinished</b>(<i></i>) |
|
382 <p> |
|
383 Public method called if a test has finished. |
|
384 </p><p> |
|
385 <b>Note</b>: It is also called if it has already failed or errored. |
|
386 </p><a NAME="UnittestDialog.testStarted" ID="UnittestDialog.testStarted"></a> |
|
387 <h4>UnittestDialog.testStarted</h4> |
|
388 <b>testStarted</b>(<i>test, doc</i>) |
|
389 <p> |
|
390 Public method called if a test is about to be run. |
|
391 </p><dl> |
|
392 <dt><i>test</i></dt> |
|
393 <dd> |
|
394 name of the started test (string) |
|
395 </dd><dt><i>doc</i></dt> |
|
396 <dd> |
|
397 documentation of the started test (string) |
|
398 </dd> |
|
399 </dl> |
|
400 <div align="right"><a href="#top">Up</a></div> |
|
401 <hr /><hr /> |
|
402 <a NAME="UnittestWindow" ID="UnittestWindow"></a> |
|
403 <h2>UnittestWindow</h2> |
|
404 <p> |
|
405 Main window class for the standalone dialog. |
|
406 </p> |
|
407 <h3>Derived from</h3> |
|
408 QMainWindow |
|
409 <h3>Class Attributes</h3> |
|
410 <table> |
|
411 <tr><td>None</td></tr> |
|
412 </table> |
|
413 <h3>Methods</h3> |
|
414 <table> |
|
415 <tr> |
|
416 <td><a href="#UnittestWindow.__init__">UnittestWindow</a></td> |
|
417 <td>Constructor</td> |
|
418 </tr><tr> |
|
419 <td><a href="#UnittestWindow.eventFilter">eventFilter</a></td> |
|
420 <td>Public method to filter events.</td> |
|
421 </tr> |
|
422 </table> |
|
423 <a NAME="UnittestWindow.__init__" ID="UnittestWindow.__init__"></a> |
|
424 <h4>UnittestWindow (Constructor)</h4> |
|
425 <b>UnittestWindow</b>(<i>prog = None, parent = None</i>) |
|
426 <p> |
|
427 Constructor |
|
428 </p><dl> |
|
429 <dt><i>prog</i></dt> |
|
430 <dd> |
|
431 filename of the program to open |
|
432 </dd><dt><i>parent</i></dt> |
|
433 <dd> |
|
434 reference to the parent widget (QWidget) |
|
435 </dd> |
|
436 </dl><a NAME="UnittestWindow.eventFilter" ID="UnittestWindow.eventFilter"></a> |
|
437 <h4>UnittestWindow.eventFilter</h4> |
|
438 <b>eventFilter</b>(<i>obj, event</i>) |
|
439 <p> |
|
440 Public method to filter events. |
|
441 </p><dl> |
|
442 <dt><i>obj</i></dt> |
|
443 <dd> |
|
444 reference to the object the event is meant for (QObject) |
|
445 </dd><dt><i>event</i></dt> |
|
446 <dd> |
|
447 reference to the event object (QEvent) |
|
448 </dd> |
|
449 </dl><dl> |
|
450 <dt>Returns:</dt> |
|
451 <dd> |
|
452 flag indicating, whether the event was handled (boolean) |
|
453 </dd> |
|
454 </dl> |
|
455 <div align="right"><a href="#top">Up</a></div> |
|
456 <hr /> |
|
457 </body></html> |