mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #27922: IDLE tests no longer flash tk widgets.
This commit is contained in:
parent
c7bab7cbf5
commit
00b1e0f7ea
6 changed files with 13 additions and 5 deletions
|
@ -15,6 +15,7 @@ class ConfigDialogTest(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.root = Tk()
|
cls.root = Tk()
|
||||||
|
cls.root.withdraw()
|
||||||
macosx._initializeTkVariantTests(cls.root)
|
macosx._initializeTkVariantTests(cls.root)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -16,6 +16,7 @@ class PasteTest(unittest.TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls.root = root = tk.Tk()
|
cls.root = root = tk.Tk()
|
||||||
|
root.withdraw()
|
||||||
PyShell.fix_x11_paste(root)
|
PyShell.fix_x11_paste(root)
|
||||||
cls.text = tk.Text(root)
|
cls.text = tk.Text(root)
|
||||||
cls.entry = tk.Entry(root)
|
cls.entry = tk.Entry(root)
|
||||||
|
|
|
@ -37,6 +37,7 @@ class HyperParserTest(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
requires('gui')
|
requires('gui')
|
||||||
cls.root = Tk()
|
cls.root = Tk()
|
||||||
|
cls.root.withdraw()
|
||||||
cls.text = Text(cls.root)
|
cls.text = Text(cls.root)
|
||||||
cls.editwin = DummyEditwin(cls.text)
|
cls.editwin = DummyEditwin(cls.text)
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ class FetchTest(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
requires('gui')
|
requires('gui')
|
||||||
cls.root = tk.Tk()
|
cls.root = tk.Tk()
|
||||||
|
cls.root.withdraw()
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.text = text = TextWrapper(self.root)
|
self.text = text = TextWrapper(self.root)
|
||||||
|
|
|
@ -20,15 +20,16 @@ from idlelib.idle_test.mock_tk import Mbox
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
global root
|
global root
|
||||||
root = Tk()
|
root = Tk()
|
||||||
|
root.withdraw()
|
||||||
|
|
||||||
def tearDownModule():
|
def tearDownModule():
|
||||||
global root
|
global root
|
||||||
root.update_idletasks()
|
root.update_idletasks()
|
||||||
root.destroy() # pyflakes falsely sees root as undefined
|
root.destroy() # Pyflakes falsely sees root as undefined.
|
||||||
del root
|
del root
|
||||||
|
|
||||||
|
|
||||||
class TV(tv.TextViewer): # used by TextViewTest
|
class TV(tv.TextViewer): # Used in TextViewTest.
|
||||||
transient = Func()
|
transient = Func()
|
||||||
grab_set = Func()
|
grab_set = Func()
|
||||||
wait_window = Func()
|
wait_window = Func()
|
||||||
|
@ -59,8 +60,8 @@ class TextViewTest(unittest.TestCase):
|
||||||
view.destroy = Func()
|
view.destroy = Func()
|
||||||
view.Ok()
|
view.Ok()
|
||||||
self.assertTrue(view.destroy.called)
|
self.assertTrue(view.destroy.called)
|
||||||
del view.destroy # unmask real function
|
del view.destroy # Unmask real function.
|
||||||
view.destroy
|
view.destroy()
|
||||||
|
|
||||||
|
|
||||||
class textviewTest(unittest.TestCase):
|
class textviewTest(unittest.TestCase):
|
||||||
|
@ -76,9 +77,10 @@ class textviewTest(unittest.TestCase):
|
||||||
del cls.orig_mbox
|
del cls.orig_mbox
|
||||||
|
|
||||||
def test_view_text(self):
|
def test_view_text(self):
|
||||||
# If modal True, tkinter will error with 'can't invoke "event" command'
|
# If modal True, get tk error 'can't invoke "event" command'.
|
||||||
view = tv.view_text(root, 'Title', 'test text', modal=False)
|
view = tv.view_text(root, 'Title', 'test text', modal=False)
|
||||||
self.assertIsInstance(view, tv.TextViewer)
|
self.assertIsInstance(view, tv.TextViewer)
|
||||||
|
view.Ok()
|
||||||
|
|
||||||
def test_view_file(self):
|
def test_view_file(self):
|
||||||
test_dir = os.path.dirname(__file__)
|
test_dir = os.path.dirname(__file__)
|
||||||
|
|
|
@ -15,6 +15,7 @@ class InitCloseTest(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
requires('gui')
|
requires('gui')
|
||||||
cls.root = Tk()
|
cls.root = Tk()
|
||||||
|
cls.root.withdraw()
|
||||||
cls.text = Text(cls.root)
|
cls.text = Text(cls.root)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -44,6 +45,7 @@ class WidgetRedirectorTest(unittest.TestCase):
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
requires('gui')
|
requires('gui')
|
||||||
cls.root = Tk()
|
cls.root = Tk()
|
||||||
|
cls.root.withdraw()
|
||||||
cls.text = Text(cls.root)
|
cls.text = Text(cls.root)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue