mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-33855: Still more edits and minimal tests for IDLE (GH-7784)
Part 3 of 3, continuing PR #7689. This covers 14 idlelib modules and their tests, rpc to zoomheight except for run (already done) and tooltip (being done separately).
This commit is contained in:
parent
00f9edb98d
commit
4d92158f4c
36 changed files with 358 additions and 97 deletions
|
@ -5,20 +5,18 @@ This file could be expanded to include traceback overrides
|
|||
Revise if output destination changes (http://bugs.python.org/issue18318).
|
||||
Make sure warnings module is left unaltered (http://bugs.python.org/issue18081).
|
||||
'''
|
||||
|
||||
from idlelib import run
|
||||
from idlelib import pyshell as shell
|
||||
import unittest
|
||||
from test.support import captured_stderr
|
||||
|
||||
import warnings
|
||||
|
||||
# Try to capture default showwarning before Idle modules are imported.
|
||||
showwarning = warnings.showwarning
|
||||
# But if we run this file within idle, we are in the middle of the run.main loop
|
||||
# and default showwarnings has already been replaced.
|
||||
running_in_idle = 'idle' in showwarning.__name__
|
||||
|
||||
from idlelib import run
|
||||
from idlelib import pyshell as shell
|
||||
|
||||
# The following was generated from pyshell.idle_formatwarning
|
||||
# and checked as matching expectation.
|
||||
idlemsg = '''
|
||||
|
@ -29,6 +27,7 @@ UserWarning: Test
|
|||
'''
|
||||
shellmsg = idlemsg + ">>> "
|
||||
|
||||
|
||||
class RunWarnTest(unittest.TestCase):
|
||||
|
||||
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
|
||||
|
@ -46,6 +45,7 @@ class RunWarnTest(unittest.TestCase):
|
|||
# The following uses .splitlines to erase line-ending differences
|
||||
self.assertEqual(idlemsg.splitlines(), f.getvalue().splitlines())
|
||||
|
||||
|
||||
class ShellWarnTest(unittest.TestCase):
|
||||
|
||||
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
|
||||
|
@ -70,4 +70,4 @@ class ShellWarnTest(unittest.TestCase):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(verbosity=2, exit=False)
|
||||
unittest.main(verbosity=2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue