summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2015-09-09 02:10:47 -0400
committerTerry Jan Reedy <tjreedy@udel.edu>2015-09-09 02:10:47 -0400
commit29bdbd0270b64b6625be2c94240d2b0a233f8ea5 (patch)
tree00f8f026d5a766603fadef6b31c4a40b2301a754
parent2b6ccb823547377f922e867a48c92705ebdbff6e (diff)
parent52ee2471b3e0a62db47e36f7f8fe7a2c24ac1ff9 (diff)
downloadcpython-git-29bdbd0270b64b6625be2c94240d2b0a233f8ea5.tar.gz
Merge with 3.5
-rw-r--r--Lib/idlelib/idle_test/test_warning.py9
-rw-r--r--Lib/idlelib/idlever.py12
2 files changed, 19 insertions, 2 deletions
diff --git a/Lib/idlelib/idle_test/test_warning.py b/Lib/idlelib/idle_test/test_warning.py
index 18627ddd23..54ac993e88 100644
--- 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:
+ warnings.simplefilter("always")
+ import idlelib.idlever
+ self.assertEqual(len(w), 1)
+ self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
+ self.assertIn("version", str(w[-1].message))
+
if __name__ == '__main__':
unittest.main(verbosity=2, exit=False)
diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py
index 563d933f3b..13c68b8969 100644
--- 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
+ from sys import version
+ IDLE_VERSION = version[:version.index(' ')]
+"""
+# 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(' ')]