Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled.

Fix code and tests that fail with this restriction.
Fix htests to not create a second and redundant root and mainloop.
This commit is contained in:
Terry Jan Reedy 2016-06-21 18:41:38 -04:00
parent aacd53f6cb
commit b60adc54d4
15 changed files with 92 additions and 84 deletions

View file

@ -74,7 +74,7 @@ class SearchDialogBaseTest(unittest.TestCase):
def test_make_entry(self):
equal = self.assertEqual
self.dialog.row = 0
self.dialog.top = Toplevel(self.root)
self.dialog.top = self.root
entry, label = self.dialog.make_entry("Test:", 'hello')
equal(label['text'], 'Test:')
@ -87,6 +87,7 @@ class SearchDialogBaseTest(unittest.TestCase):
equal(self.dialog.row, 1)
def test_create_entries(self):
self.dialog.top = self.root
self.dialog.row = 0
self.engine.setpat('hello')
self.dialog.create_entries()
@ -94,7 +95,7 @@ class SearchDialogBaseTest(unittest.TestCase):
def test_make_frame(self):
self.dialog.row = 0
self.dialog.top = Toplevel(self.root)
self.dialog.top = self.root
frame, label = self.dialog.make_frame()
self.assertEqual(label, '')
self.assertIsInstance(frame, Frame)
@ -104,7 +105,7 @@ class SearchDialogBaseTest(unittest.TestCase):
self.assertIsInstance(frame, Frame)
def btn_test_setup(self, meth):
self.dialog.top = Toplevel(self.root)
self.dialog.top = self.root
self.dialog.row = 0
return meth()
@ -145,12 +146,13 @@ class SearchDialogBaseTest(unittest.TestCase):
self.assertEqual(var.get(), state)
def test_make_button(self):
self.dialog.top = Toplevel(self.root)
self.dialog.top = self.root
self.dialog.buttonframe = Frame(self.dialog.top)
btn = self.dialog.make_button('Test', self.dialog.close)
self.assertEqual(btn['text'], 'Test')
def test_create_command_buttons(self):
self.dialog.top = self.root
self.dialog.create_command_buttons()
# Look for close button command in buttonframe
closebuttoncommand = ''