This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients cheryl.sabella, serhiy.storchaka, terry.reedy
Date 2018-06-15.05:40:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1529041258.28.0.947875510639.issue32839@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2018-06-15 05:40:58terry.reedysetrecipients: + terry.reedy, serhiy.storchaka, cheryl.sabella
2018-06-15 05:40:58terry.reedysetmessageid: <1529041258.28.0.947875510639.issue32839@psf.upfronthosting.co.za>
2018-06-15 05:40:58terry.reedylinkissue32839 messages
2018-06-15 05:40:57terry.reedycreate