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