PyUnit/UnittestDialog.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3038
7fe9a53280bd
child 3145
a9de05d4a22f
equal deleted inserted replaced
3058:0a02c433f52d 3060:5883ce99ee12
219 if self.dbs: 219 if self.dbs:
220 exts = self.dbs.getExtensions("Python2") 220 exts = self.dbs.getExtensions("Python2")
221 flags = Utilities.extractFlagsFromFile(txt) 221 flags = Utilities.extractFlagsFromFile(txt)
222 if txt.endswith(exts) or \ 222 if txt.endswith(exts) or \
223 ("FileType" in flags and 223 ("FileType" in flags and
224 flags["FileType"] in ["Python", "Python2"]): 224 flags["FileType"] in ["Python", "Python2"]):
225 self.coverageCheckBox.setChecked(False) 225 self.coverageCheckBox.setChecked(False)
226 self.coverageCheckBox.setEnabled(False) 226 self.coverageCheckBox.setEnabled(False)
227 self.localCheckBox.setChecked(False) 227 self.localCheckBox.setChecked(False)
228 self.localCheckBox.setEnabled(False) 228 self.localCheckBox.setEnabled(False)
229 return 229 return
286 mainScript = os.path.abspath(prog) 286 mainScript = os.path.abspath(prog)
287 flags = Utilities.extractFlagsFromFile(mainScript) 287 flags = Utilities.extractFlagsFromFile(mainScript)
288 if mainScript.endswith( 288 if mainScript.endswith(
289 tuple(Preferences.getPython("PythonExtensions"))) or \ 289 tuple(Preferences.getPython("PythonExtensions"))) or \
290 ("FileType" in flags and 290 ("FileType" in flags and
291 flags["FileType"] in ["Python", "Python2"]): 291 flags["FileType"] in ["Python", "Python2"]):
292 clientType = "Python2" 292 clientType = "Python2"
293 else: 293 else:
294 clientType = "" 294 clientType = ""
295 if failedOnly and self.__failedTests: 295 if failedOnly and self.__failedTests:
296 failed = [t.split(".", 1)[1] for t in self.__failedTests] 296 failed = [t.split(".", 1)[1] for t in self.__failedTests]
335 self, 335 self,
336 self.trUtf8("Unittest"), 336 self.trUtf8("Unittest"),
337 self.trUtf8( 337 self.trUtf8(
338 "<p>Unable to run test <b>{0}</b>.<br>" 338 "<p>Unable to run test <b>{0}</b>.<br>"
339 "{1}<br>{2}</p>") 339 "{1}<br>{2}</p>")
340 .format(self.testName, str(exc_type), 340 .format(self.testName, str(exc_type),
341 str(exc_value))) 341 str(exc_value)))
342 return 342 return
343 343
344 # now set up the coverage stuff 344 # now set up the coverage stuff
345 if self.coverageCheckBox.isChecked(): 345 if self.coverageCheckBox.isChecked():
346 if self.dbs: 346 if self.dbs:
356 mainScript = os.path.abspath(prog) 356 mainScript = os.path.abspath(prog)
357 357
358 from DebugClients.Python3.coverage import coverage 358 from DebugClients.Python3.coverage import coverage
359 cover = coverage( 359 cover = coverage(
360 data_file="{0}.coverage".format( 360 data_file="{0}.coverage".format(
361 os.path.splitext(mainScript)[0])) 361 os.path.splitext(mainScript)[0]))
362 cover.use_cache(True) 362 cover.use_cache(True)
363 if self.coverageEraseCheckBox.isChecked(): 363 if self.coverageEraseCheckBox.isChecked():
364 cover.erase() 364 cover.erase()
365 else: 365 else:
366 cover = None 366 cover = None
393 E5MessageBox.critical( 393 E5MessageBox.critical(
394 self, 394 self,
395 self.trUtf8("Unittest"), 395 self.trUtf8("Unittest"),
396 self.trUtf8( 396 self.trUtf8(
397 "<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>") 397 "<p>Unable to run test <b>{0}</b>.<br>{1}<br>{2}</p>")
398 .format(self.testName, exc_type, exc_value)) 398 .format(self.testName, exc_type, exc_value))
399 return 399 return
400 400
401 self.totalTests = nrTests 401 self.totalTests = nrTests
402 self.__setRunningMode() 402 self.__setRunningMode()
403 self.dbs.remoteUTRun() 403 self.dbs.remoteUTRun()

eric ide

mercurial