Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78c330d

Browse files
committed
Merge with 3.3
2 parents b5782de + 9db1ab8 commit 78c330d

6 files changed

Lines changed: 14 additions & 3 deletions

File tree

Lib/idlelib/idle_test/README.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,10 @@ idle class. For the benefit of buildbot machines that do not have a graphics
4141
screen, gui tests must be 'guarded' by "requires('gui')" in a setUp
4242
function or method. This will typically be setUpClass.
4343

44-
All gui objects must be destroyed by the end of the test, perhaps in a tearDown
45-
function. Creating the Tk root directly in a setUp allows a reference to be saved
46-
so it can be properly destroyed in the corresponding tearDown.
44+
To avoid interfering with other gui tests, all gui objects must be destroyed
45+
and deleted by the end of the test. If a widget, such as a Tk root, is created
46+
in a setUpX function, destroy it in the corresponding tearDownX. For module
47+
and class attributes, also delete the widget.
4748
---
4849
@classmethod
4950
def setUpClass(cls):
@@ -53,6 +54,7 @@ so it can be properly destroyed in the corresponding tearDown.
5354
@classmethod
5455
def tearDownClass(cls):
5556
cls.root.destroy()
57+
del cls.root
5658
---
5759

5860
Support.requires('gui') returns true if it is either called in a main module

Lib/idlelib/idle_test/test_formatparagraph.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ def setUpClass(cls):
277277
@classmethod
278278
def tearDownClass(cls):
279279
cls.root.destroy()
280+
del cls.root
281+
del cls.text
282+
del cls.formatter
280283

281284
def test_short_line(self):
282285
self.text.insert('1.0', "Short line\n")

Lib/idlelib/idle_test/test_idlehistory.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def setUp(self):
8080
@classmethod
8181
def tearDownClass(cls):
8282
cls.root.destroy()
83+
del cls.root
8384

8485
def fetch_test(self, reverse, line, prefix, index, *, bell=False):
8586
# Perform one fetch as invoked by Alt-N or Alt-P

Lib/idlelib/idle_test/test_searchengine.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class GetSelectionTest(unittest.TestCase):
6464
## @classmethod
6565
## def tearDownClass(cls):
6666
## cls.root.destroy()
67+
## del cls.root
6768

6869
def test_get_selection(self):
6970
# text = Text(master=self.root)
@@ -219,6 +220,7 @@ def setUpClass(cls):
219220
## @classmethod
220221
## def tearDownClass(cls):
221222
## cls.root.destroy()
223+
## del cls.root
222224

223225
def test_search(self):
224226
Equal = self.assertEqual
@@ -261,6 +263,7 @@ class ForwardBackwardTest(unittest.TestCase):
261263
## @classmethod
262264
## def tearDownClass(cls):
263265
## cls.root.destroy()
266+
## del cls.root
264267

265268
@classmethod
266269
def setUpClass(cls):

Lib/idlelib/idle_test/test_text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def setUpClass(cls):
221221
@classmethod
222222
def tearDownClass(cls):
223223
cls.root.destroy()
224+
del cls.root
224225

225226

226227
if __name__ == '__main__':

Lib/test/test_idle.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
try:
1515
root = tk.Tk()
1616
root.destroy()
17+
del root
1718
except tk.TclError:
1819
while 'gui' in use_resources:
1920
use_resources.remove('gui')

0 commit comments

Comments
 (0)