The only recently added tests are the 11 in test_sidebar.ShellSidebarTest. Leak testing just these with
python -m test -R3:3 -ugui -m *Sidebar* test_idle
does not fail. Leak test all of test_idle with
>python -m test -R3:3 -v -ugui test_idle
ends after the second round with two error failures.
FAIL: test_menudefs (idlelib.idle_test.test_mainmenu.MainMenuTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "f:\dev\3x\lib\idlelib\idle_test\test_mainmenu.py", line 15, in test_menudefs
self.assertEqual(actual, expect)
AssertionError: Lists differ:
['application', 'file', 'edit', 'format', '[47 chars]elp'] !=
['file', 'edit', 'format', 'run', 'shell', [32 chars]elp']
The 'application' menu was by added by a call to macosx.setupApp, which calls overrideRootMenu, in ShellSidebarTest.setUpClass. This call is not needed for this testcase, so the first PR replaces it with a comment referring to this issue.
Note: when test_macosc calls setupApp, overrideRootMenu is replaced with a mock.
The second execution of ShellSidebarTest.setUpClass failed with
ERROR: setUpClass (idlelib.idle_test.test_sidebar.ShellSidebarTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "f:\dev\3x\lib\idlelib\idle_test\test_sidebar.py", line 414, in setUpClass
cls.init_shell()
File "f:\dev\3x\lib\idlelib\idle_test\test_sidebar.py", line 429, in init_shell
cls.shell = cls.flist.open_shell()
File "f:\dev\3x\lib\idlelib\pyshell.py", line 334, in open_shell
self.pyshell = PyShell(self)
File "f:\dev\3x\lib\idlelib\pyshell.py", line 890, in __init__
OutputWindow.__init__(self, flist, None, None)
File "f:\dev\3x\lib\idlelib\outwin.py", line 79, in __init__
EditorWindow.__init__(self, *args)
File "f:\dev\3x\lib\idlelib\editor.py", line 342, in __init__
self.update_menu_state('options', '*ode*ontext', 'disabled')
File "f:\dev\3x\lib\idlelib\editor.py", line 488, in update_menu_state
menuitem.entryconfig(index, state=state)
File "f:\dev\3x\lib\tkinter\__init__.py", line 3383, in entryconfigure
return self._configure(('entryconfigure', index), cnf, kw)
File "f:\dev\3x\lib\tkinter\__init__.py", line 1660, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: bad menu entry index "*ode*ontext"
One of the things that overrideRootMenu does is to move the option setting item, above the code context item, to the application submenu. I don't understand why this caused the failure above. However, removing the setupApp call fixed this failure also. The first PR does this.
With this fix, test_idle runs 6 times with leak report
test_idle leaked [684, 684, 684] references, sum=2052
test_idle leaked [282, 282, 282] memory blocks, sum=846
With ShellSidebarTest skipped, the result is only slightly better.
test_idle leaked [684, 684, 665] references, sum=2033
test_idle leaked [282, 282, 283] memory blocks, sum=847
|
test_squeezer.ExpandingButtonTest accounts for most of the leak.
python -m test -R3:3 -v -ugui -m *zer.Expand* test_idle
test_idle leaked [576, 576, 576] references, sum=1728
test_idle leaked [282, 282, 282] memory blocks, sum=846
All 6 methods failed. I believe the difference [108, 108, 108] [0, 0, 0] would not be a failure.
Yesterday's patch, https://github.com/python/cpython/pull/22682/files,
only made what seems like a trivial change in 2 of the 6 methods. Only a name was changed in squeeze.py.
Tal, any idea why these are leaking?
|