eric7/PyUnit/UnittestDialog.py

branch
unittest
changeset 9066
a219ade50f7c
parent 9055
08b2702b4f81
equal deleted inserted replaced
9065:39405e6eba20 9066:a219ade50f7c
31 import UI.PixmapCache 31 import UI.PixmapCache
32 32
33 import Preferences 33 import Preferences
34 34
35 from Globals import ( 35 from Globals import (
36 recentNameUnittestDiscoverHistory, recentNameUnittestFileHistory, 36 recentNameTestDiscoverHistory, recentNameTestFileHistory,
37 recentNameUnittestTestnameHistory 37 recentNameTestNameHistory
38 ) 38 )
39 39
40 40
41 class UnittestDialog(QWidget, Ui_UnittestDialog): 41 class UnittestDialog(QWidget, Ui_UnittestDialog):
42 """ 42 """
415 Preferences.Prefs.rsettings.sync() 415 Preferences.Prefs.rsettings.sync()
416 416
417 # 1. discovery history 417 # 1. discovery history
418 self.discoverHistory = [] 418 self.discoverHistory = []
419 rs = Preferences.Prefs.rsettings.value( 419 rs = Preferences.Prefs.rsettings.value(
420 recentNameUnittestDiscoverHistory) 420 recentNameTestDiscoverHistory)
421 if rs is not None: 421 if rs is not None:
422 recent = [f 422 recent = [f
423 for f in Preferences.toList(rs) 423 for f in Preferences.toList(rs)
424 if QFileInfo(f).exists()] 424 if QFileInfo(f).exists()]
425 self.discoverHistory = recent[ 425 self.discoverHistory = recent[
426 :Preferences.getDebugger("RecentNumber")] 426 :Preferences.getDebugger("RecentNumber")]
427 427
428 # 2. test file history 428 # 2. test file history
429 self.fileHistory = [] 429 self.fileHistory = []
430 rs = Preferences.Prefs.rsettings.value( 430 rs = Preferences.Prefs.rsettings.value(
431 recentNameUnittestFileHistory) 431 recentNameTestFileHistory)
432 if rs is not None: 432 if rs is not None:
433 recent = [f 433 recent = [f
434 for f in Preferences.toList(rs) 434 for f in Preferences.toList(rs)
435 if QFileInfo(f).exists()] 435 if QFileInfo(f).exists()]
436 self.fileHistory = recent[ 436 self.fileHistory = recent[
437 :Preferences.getDebugger("RecentNumber")] 437 :Preferences.getDebugger("RecentNumber")]
438 438
439 # 3. test name history 439 # 3. test name history
440 self.testNameHistory = [] 440 self.testNameHistory = []
441 rs = Preferences.Prefs.rsettings.value( 441 rs = Preferences.Prefs.rsettings.value(
442 recentNameUnittestTestnameHistory) 442 recentNameTestNameHistory)
443 if rs is not None: 443 if rs is not None:
444 recent = [n for n in Preferences.toList(rs) if n] 444 recent = [n for n in Preferences.toList(rs) if n]
445 self.testNameHistory = recent[ 445 self.testNameHistory = recent[
446 :Preferences.getDebugger("RecentNumber")] 446 :Preferences.getDebugger("RecentNumber")]
447 447
448 def __saveRecent(self): 448 def __saveRecent(self):
449 """ 449 """
450 Private method to save the most recently used lists. 450 Private method to save the most recently used lists.
451 """ 451 """
452 Preferences.Prefs.rsettings.setValue( 452 Preferences.Prefs.rsettings.setValue(
453 recentNameUnittestDiscoverHistory, self.discoverHistory) 453 recentNameTestDiscoverHistory, self.discoverHistory)
454 Preferences.Prefs.rsettings.setValue( 454 Preferences.Prefs.rsettings.setValue(
455 recentNameUnittestFileHistory, self.fileHistory) 455 recentNameTestFileHistory, self.fileHistory)
456 Preferences.Prefs.rsettings.setValue( 456 Preferences.Prefs.rsettings.setValue(
457 recentNameUnittestTestnameHistory, self.testNameHistory) 457 recentNameTestNameHistory, self.testNameHistory)
458 458
459 Preferences.Prefs.rsettings.sync() 459 Preferences.Prefs.rsettings.sync()
460 460
461 @pyqtSlot() 461 @pyqtSlot()
462 def clearRecent(self): 462 def clearRecent(self):
1495 def clearSavedHistories(self): 1495 def clearSavedHistories(self):
1496 """ 1496 """
1497 Function to clear the saved history lists. 1497 Function to clear the saved history lists.
1498 """ 1498 """
1499 Preferences.Prefs.rsettings.setValue( 1499 Preferences.Prefs.rsettings.setValue(
1500 recentNameUnittestDiscoverHistory, []) 1500 recentNameTestDiscoverHistory, [])
1501 Preferences.Prefs.rsettings.setValue( 1501 Preferences.Prefs.rsettings.setValue(
1502 recentNameUnittestFileHistory, []) 1502 recentNameTestFileHistory, [])
1503 Preferences.Prefs.rsettings.setValue( 1503 Preferences.Prefs.rsettings.setValue(
1504 recentNameUnittestTestnameHistory, []) 1504 recentNameTestNameHistory, [])
1505 1505
1506 Preferences.Prefs.rsettings.sync() 1506 Preferences.Prefs.rsettings.sync()

eric ide

mercurial