Terry J. Reedy added the comment:

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.

----------

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

Reply via email to