summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test/test_warning.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/idlelib/idle_test/test_warning.py')
-rw-r--r--Lib/idlelib/idle_test/test_warning.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/idlelib/idle_test/test_warning.py b/Lib/idlelib/idle_test/test_warning.py
index 221068c..da1d8a1 100644
--- a/Lib/idlelib/idle_test/test_warning.py
+++ b/Lib/idlelib/idle_test/test_warning.py
@@ -1,23 +1,25 @@
-'''Test warnings replacement in pyshell.py and run.py.
+'''Test warnings replacement in PyShell.py and run.py.
This file could be expanded to include traceback overrides
(in same two modules). If so, change name.
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
+from test.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__
-# The following was generated from pyshell.idle_formatwarning
+from idlelib import run
+from idlelib import PyShell as shell
+
+# The following was generated from PyShell.idle_formatwarning
# and checked as matching expectation.
idlemsg = '''
Warning (from warnings module):
@@ -27,7 +29,6 @@ UserWarning: Test
'''
shellmsg = idlemsg + ">>> "
-
class RunWarnTest(unittest.TestCase):
@unittest.skipIf(running_in_idle, "Does not work when run within Idle.")
@@ -45,7 +46,6 @@ 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)
+ unittest.main(verbosity=2, exit=False)