Terry J. Reedy added the comment:
The patch works to suppress the message for test_ttk_guionly. However,
unfix_environ does not undo everything that needs to be undone, as evidenced by
#20800.
The patch does not fix test_idle. I suspect that this is because test_idle
pulls in tests from numerous modules, none of which has the unfix call.
However, rather than require a tearDowmnodule for every module that imports
tkinter, lets fix the root problem. I thought of having the environment change
warning function ignore changes to TCL/TK/TIX_LIBRARY, but even better would be
to not change them. Rename _fix to _dirs and redefine its mission as setting
and holding three module attributes: tcldir, tkdir, and tixdir. They would be
set from either the environment or the alternate search code. Any other modules
that need the info should get it from _dirs rather the environment.
I believe this part of _fix is buggy.
+ if "TCL_LIBRARY" not in os.environ:
+ for name in os.listdir(prefix):
+ if name.startswith("tcl"):
+ tcldir = os.path.join(prefix,name)
+ if os.path.isdir(tcldir):
+ os.environ["TCL_LIBRARY"] = tcldir
Both base/tcl and base/../tcktk/lib contain (for 3.4) directories named tcl8
and tcl8.6. Since only tcl8.6 works, the code above depends on listdir
presenting it second. The 'if name' clause could be augmented with 'and
name[-2] == '.'.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20035>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com