1"Test pyshell, coverage 12%." 2# Plus coverage of test_warning. Was 20% with test_openshell. 3 4from idlelib import pyshell 5import unittest 6from test.support import requires 7from tkinter import Tk 8 9 10class PyShellFileListTest(unittest.TestCase): 11 12 @classmethod 13 def setUpClass(cls): 14 requires('gui') 15 cls.root = Tk() 16 cls.root.withdraw() 17 18 @classmethod 19 def tearDownClass(cls): 20 #cls.root.update_idletasks() 21## for id in cls.root.tk.call('after', 'info'): 22## cls.root.after_cancel(id) # Need for EditorWindow. 23 cls.root.destroy() 24 del cls.root 25 26 def test_init(self): 27 psfl = pyshell.PyShellFileList(self.root) 28 self.assertEqual(psfl.EditorWindow, pyshell.PyShellEditorWindow) 29 self.assertIsNone(psfl.pyshell) 30 31# The following sometimes causes 'invalid command name "109734456recolorize"'. 32# Uncommenting after_cancel above prevents this, but results in 33# TclError: bad window path name ".!listedtoplevel.!frame.text" 34# which is normally prevented by after_cancel. 35## def test_openshell(self): 36## pyshell.use_subprocess = False 37## ps = pyshell.PyShellFileList(self.root).open_shell() 38## self.assertIsInstance(ps, pyshell.PyShell) 39 40 41if __name__ == '__main__': 42 unittest.main(verbosity=2) 43