Author terry.reedy
Recipients martin.panter, python-dev, serhiy.storchaka, terry.reedy, zach.ware
Date 2016-08-16.04:11:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1471320684.67.0.795094264095.issue27611@psf.upfronthosting.co.za>
In-reply-to
Content
Ned Deily noticed the same problem when running with test.regrtest #27714.

I cannot reproduce this issue when running both tests either with unittest or test.regrtest.

F:\Python\dev>36\pcbuild\win32\python_d.exe -m unittest test.test_tix test.test_idle test.test_tix
.............................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 221 tests in 3.959s

OK
F:\Python\dev>36\pcbuild\win32\python_d.exe -m test -ugui test_tix test_idle test_tix
Run tests sequentially
0:00:00 [1/3] test_tix
0:00:00 [2/3] test_idle
0:00:03 [3/3] test_tix
All 3 tests OK.
 if __name__ == '__main__':
     unittest.main(verbosity=2, exit=False)
+    tk._support_default_root = 1
+    tk._default_root = None

Zach, I don't know of any way to get either unittest or test.regrtest to run anything in test_idle after it runs the test collector *and* the tests.  Do you?

The addition of tk.NoDefaultRoot() to both IDLE and its tests was suggested by Serhiy in #24137.  Doing so exposed several issues in htests but no real bugs in IDLE itself. My patch to restore tkinter module only works when test_idle is run as main.  So as far as that patch goes, tkinter should only changed when the test is run as main.  I will move the call.  I have already changed my check script to run test_idle this way.

Otherwise, the easiest way to leave tkinter as it was when testing ends is to not change it.  I am aware that tkinter tests avoid the  by defining a mixin class with class methods that call and undo the call.  It is used in 11 test classes within the tkinter and ttk tests.  However, this refactoring would be harder to apply to IDLE tests and not sufficient in itself.  It is at best a future project.

I added a guard to IDLE's NoDefaultRoot call for when pyshell.main is broken into multiple testable functions.
History
Date User Action Args
2016-08-16 04:11:24terry.reedysetrecipients: + terry.reedy, python-dev, martin.panter, zach.ware, serhiy.storchaka
2016-08-16 04:11:24terry.reedysetmessageid: <1471320684.67.0.795094264095.issue27611@psf.upfronthosting.co.za>
2016-08-16 04:11:24terry.reedylinkissue27611 messages
2016-08-16 04:11:23terry.reedycreate