Author terry.reedy
Recipients pablogsal, terry.reedy
Date 2021-04-30.03:24:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619753084.46.0.663802392468.issue43981@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-04-30 03:24:44terry.reedysetrecipients: + terry.reedy, pablogsal
2021-04-30 03:24:44terry.reedysetmessageid: <1619753084.46.0.663802392468.issue43981@roundup.psfhosted.org>
2021-04-30 03:24:44terry.reedylinkissue43981 messages
2021-04-30 03:24:43terry.reedycreate