summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-01-29 01:47:41 (GMT)
committerGitHub <noreply@github.com>2021-01-29 01:47:41 (GMT)
commit901a9834420e516c07d6cad356d2be481db6d8d1 (patch)
tree418fe88925f207a8a5e06db5b2d5b9303fffaa38 /Lib/idlelib/idle_test
parent81b23a9b148b60f8f541e4b06e1d88c58644e3b8 (diff)
downloadcpython-901a9834420e516c07d6cad356d2be481db6d8d1.zip
cpython-901a9834420e516c07d6cad356d2be481db6d8d1.tar.gz
cpython-901a9834420e516c07d6cad356d2be481db6d8d1.tar.bz2
bpo-23544: Disable IDLE Stack Viewer when running user code (GH-17163) (#24366)
Starting stack viewer when user code is running, including when Debugger is active, hangs or crashes IDLE. Co-authored-by: Zackery Spytz <zspytz@gmail.com> Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> (cherry picked from commit 23a567c11ca36eedde0e119443c85cc16075deaf)
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_mainmenu.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/idlelib/idle_test/test_mainmenu.py b/Lib/idlelib/idle_test/test_mainmenu.py
index 7ec0368..51d2acc 100644
--- a/Lib/idlelib/idle_test/test_mainmenu.py
+++ b/Lib/idlelib/idle_test/test_mainmenu.py
@@ -2,6 +2,7 @@
# Reported as 88%; mocking turtledemo absence would have no point.
from idlelib import mainmenu
+import re
import unittest
@@ -16,6 +17,26 @@ class MainMenuTest(unittest.TestCase):
def test_default_keydefs(self):
self.assertGreaterEqual(len(mainmenu.default_keydefs), 50)
+ def test_tcl_indexes(self):
+ # Test tcl patterns used to find menuitem to alter.
+ # On failure, change pattern here and in function(s).
+ # Patterns here have '.*' for re instead of '*' for tcl.
+ for menu, pattern in (
+ ('debug', '.*tack.*iewer'), # PyShell.debug_menu_postcommand
+ ('options', '.*ode.*ontext'), # EW.__init__, CodeContext.toggle...
+ ('options', '.*ine.*umbers'), # EW.__init__, EW.toggle...event.
+ ):
+ with self.subTest(menu=menu, pattern=pattern):
+ for menutup in mainmenu.menudefs:
+ if menutup[0] == menu:
+ break
+ else:
+ self.assertTrue(0, f"{menu} not in menudefs")
+ self.assertTrue(any(re.search(pattern, menuitem[0])
+ for menuitem in menutup[1]
+ if menuitem is not None), # Separator.
+ f"{pattern} not in {menu}")
+
if __name__ == '__main__':
unittest.main(verbosity=2)