cpython: 55b62e2c59f8 (original) (raw)
Mercurial > cpython
changeset 97797:55b62e2c59f8 2.7
Issue 24199: Deprecate idlelib.idlever with a warning on import.
Terry Jan Reedy tjreedy@udel.edu | |
---|---|
date | Wed, 09 Sep 2015 02:10:10 -0400 |
parents | ab1dc73fe8b5 |
children | 32893d8a52a9 |
files | Lib/idlelib/idle_test/test_warning.py Lib/idlelib/idlever.py |
diffstat | 2 files changed, 19 insertions(+), 2 deletions(-)[+] [-] Lib/idlelib/idle_test/test_warning.py 9 Lib/idlelib/idlever.py 12 |
line wrap: on
line diff
--- a/Lib/idlelib/idle_test/test_warning.py +++ b/Lib/idlelib/idle_test/test_warning.py @@ -68,6 +68,15 @@ class ShellWarnTest(unittest.TestCase): 'Test', UserWarning, 'test_warning.py', 99, f, 'Line of code') self.assertEqual(shellmsg.splitlines(), f.getvalue().splitlines()) +class ImportWarnTest(unittest.TestCase):
- def test_idlever(self):
with warnings.catch_warnings(record=True) as w:[](#l1.9)
warnings.simplefilter("always")[](#l1.10)
import idlelib.idlever[](#l1.11)
self.assertEqual(len(w), 1)[](#l1.12)
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))[](#l1.13)
self.assertIn("version", str(w[-1].message))[](#l1.14)
+ if name == 'main': unittest.main(verbosity=2, exit=False)
--- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1,4 +1,12 @@ -"""Unused by Idle: there is no separate Idle version anymore. -Kept only for possible existing extension use.""" +""" +The separate Idle version was eliminated years ago; +idlelib.idlever is no longer used by Idle +and will be removed in 3.6 or later. Use
+""" +# Kept for now only for possible existing extension use +import warnings as w +w.warn(doc, DeprecationWarning) from sys import version IDLE_VERSION = version[:version.index(' ')]