Terry J. Reedy <tjre...@udel.edu> added the comment:

Real use case for after_info() (with not arg): #33855 is about minimally 
testing all IDLE modules.  At least import the module and create class 
instances when easily possible.  For test_editor, I started with 

    def test_init(self):  # Temporary.
        e = Editor(root=self.root)
        self.assertEqual(e.root, self.root)

and got in Shell

warning: callback failed in WindowList <class '_tkinter.TclError'> : invalid 
command name ".!menu.windows"

and in the console

invalid command name "119640952recolorize"
    while executing
"119640952recolorize"
    ("after" script)
invalid command name "119872312timer_event"
    while executing
"119872312timer_event"
    ("after" script)
invalid command name "119872440config_timer_event"
    while executing
"119872440config_timer_event"
    ("after" script)

Perhaps this is why I previously omitted something so obvious (it add 24% to 
coverage).

I added e._close(), which tries to cleanup, and the messages, in console only, 
are reduced to

bgerror failed to handle background error.
    Original error: invalid command name "115211704timer_event"
    Error in bgerror: can't invoke "tk" command: application has been destroyed
bgerror failed to handle background error.
    Original error: invalid command name "115211832config_timer_event"
    Error in bgerror: can't invoke "tk" command: application has been destroyed

I would like to know what _close misses, but it is hard to track them down.
print(self.root.tk.call('after', 'info')) after the close returned ('after#4', 
'after#3', 'after#1', 'after#0').  Adding

        for id in cls.root.tk.call('after', 'info'):
            self.root.after_cancel(id)

before cls.root.destroy() in shutDownClass stops the messages.
--

For test_del in #32831, I think the following might work, and be much shorter 
than the current code.

n = len(self.root.tk.call('after', 'info')
self.cc.__del__()
self.assertEqual(len(self.root.tk.call('after', 'info')), n-2)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32839>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to