mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
gh-121008: Fix idlelib.run tests (#121046)
When testing IDLE, don't create a Tk to avoid side effects such as installing a PyOS_InputHook hook.
This commit is contained in:
parent
c87876763e
commit
44eafd6688
1 changed files with 13 additions and 6 deletions
|
@ -91,6 +91,13 @@ def capture_warnings(capture):
|
||||||
_warnings_showwarning = None
|
_warnings_showwarning = None
|
||||||
|
|
||||||
capture_warnings(True)
|
capture_warnings(True)
|
||||||
|
|
||||||
|
if idlelib.testing:
|
||||||
|
# gh-121008: When testing IDLE, don't create a Tk object to avoid side
|
||||||
|
# effects such as installing a PyOS_InputHook hook.
|
||||||
|
def handle_tk_events():
|
||||||
|
pass
|
||||||
|
else:
|
||||||
tcl = tkinter.Tcl()
|
tcl = tkinter.Tcl()
|
||||||
|
|
||||||
def handle_tk_events(tcl=tcl):
|
def handle_tk_events(tcl=tcl):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue