18 from PyQt4.QtGui import * |
18 from PyQt4.QtGui import * |
19 |
19 |
20 from E4Gui.E4Application import e4App |
20 from E4Gui.E4Application import e4App |
21 from E4Gui.E4Completers import E4FileCompleter |
21 from E4Gui.E4Completers import E4FileCompleter |
22 |
22 |
23 from Ui_UnittestDialog import Ui_UnittestDialog |
23 from .Ui_UnittestDialog import Ui_UnittestDialog |
24 from Ui_UnittestStacktraceDialog import Ui_UnittestStacktraceDialog |
24 from .Ui_UnittestStacktraceDialog import Ui_UnittestStacktraceDialog |
25 |
25 |
26 from DebugClients.Python.coverage import coverage |
26 from DebugClients.Python3.coverage import coverage |
27 |
27 |
28 import UI.PixmapCache |
28 import UI.PixmapCache |
29 |
29 |
30 import Utilities |
30 import Utilities |
31 |
31 |
259 except: |
259 except: |
260 exc_type, exc_value, exc_tb = sys.exc_info() |
260 exc_type, exc_value, exc_tb = sys.exc_info() |
261 QMessageBox.critical(self, |
261 QMessageBox.critical(self, |
262 self.trUtf8("Unittest"), |
262 self.trUtf8("Unittest"), |
263 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") |
263 self.trUtf8("<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") |
264 .format(self.testName, unicode(exc_type), unicode(exc_value))) |
264 .format(self.testName, str(exc_type), str(exc_value))) |
265 return |
265 return |
266 |
266 |
267 # now set up the coverage stuff |
267 # now set up the coverage stuff |
268 if self.coverageCheckBox.isChecked(): |
268 if self.coverageCheckBox.isChecked(): |
269 if self.dbs: |
269 if self.dbs: |
528 |
528 |
529 @param test Reference to the test object |
529 @param test Reference to the test object |
530 @param err The error traceback |
530 @param err The error traceback |
531 """ |
531 """ |
532 unittest.TestResult.addFailure(self, test, err) |
532 unittest.TestResult.addFailure(self, test, err) |
533 tracebackLines = apply(traceback.format_exception, err + (10,)) |
533 tracebackLines = traceback.format_exception(*err + (10,)) |
534 self.parent.testFailed(unicode(test), tracebackLines) |
534 self.parent.testFailed(str(test), tracebackLines) |
535 |
535 |
536 def addError(self, test, err): |
536 def addError(self, test, err): |
537 """ |
537 """ |
538 Method called if a test errored. |
538 Method called if a test errored. |
539 |
539 |
540 @param test Reference to the test object |
540 @param test Reference to the test object |
541 @param err The error traceback |
541 @param err The error traceback |
542 """ |
542 """ |
543 unittest.TestResult.addError(self, test, err) |
543 unittest.TestResult.addError(self, test, err) |
544 tracebackLines = apply(traceback.format_exception, err + (10,)) |
544 tracebackLines = traceback.format_exception(*err + (10,)) |
545 self.parent.testErrored(unicode(test), tracebackLines) |
545 self.parent.testErrored(str(test), tracebackLines) |
546 |
546 |
547 def startTest(self, test): |
547 def startTest(self, test): |
548 """ |
548 """ |
549 Method called at the start of a test. |
549 Method called at the start of a test. |
550 |
550 |
551 @param test Reference to the test object |
551 @param test Reference to the test object |
552 """ |
552 """ |
553 unittest.TestResult.startTest(self, test) |
553 unittest.TestResult.startTest(self, test) |
554 self.parent.testStarted(unicode(test), test.shortDescription()) |
554 self.parent.testStarted(str(test), test.shortDescription()) |
555 |
555 |
556 def stopTest(self, test): |
556 def stopTest(self, test): |
557 """ |
557 """ |
558 Method called at the end of a test. |
558 Method called at the end of a test. |
559 |
559 |