summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_warning.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2018-06-19 23:12:52 (GMT)
committerGitHub <noreply@github.com>2018-06-19 23:12:52 (GMT)
commit4d92158f4c3917fc4fbfebff15224e74782abf79 (patch)
treea3eea4b4e5e9d9b9b679eb538d9716758776c3bb /Lib/idlelib/idle_test/test_warning.py
parent00f9edb98dd64e14daf5c44f303deca5cbc3cdeb (diff)
downloadcpython-4d92158f4c3917fc4fbfebff15224e74782abf79.zip
cpython-4d92158f4c3917fc4fbfebff15224e74782abf79.tar.gz
cpython-4d92158f4c3917fc4fbfebff15224e74782abf79.tar.bz2
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).
Diffstat (limited to 'Lib/idlelib/idle_test/test_warning.py')
-rw-r--r--Lib/idlelib/idle_test/test_warning.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/idlelib/idle_test/test_warning.py b/Lib/idlelib/idle_test/test_warning.py
index f3269f1..221068c 100644
--- a/Lib/idlelib/idle_test/test_warning.py
+++ b/Lib/idlelib/idle_test/test_warning.py
@@ -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)