[Python-checkins] cpython (merge 3.3 -> default): #17143: merge with 3.3.

ezio.melotti python-checkins at python.org
Fri Feb 15 20:22:41 CET 2013


http://hg.python.org/cpython/rev/46e9f668aea9
changeset:   82210:46e9f668aea9
parent:      82208:f289e40b3d70
parent:      82209:3f8b5fcbf07e
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Fri Feb 15 21:22:22 2013 +0200
summary:
  #17143: merge with 3.3.

files:
  Lib/test/test_trace.py |  45 ++++++++++++++++++++++++++++++
  Lib/trace.py           |   1 +
  Misc/NEWS              |   3 ++
  3 files changed, 49 insertions(+), 0 deletions(-)


diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py
--- a/Lib/test/test_trace.py
+++ b/Lib/test/test_trace.py
@@ -1,7 +1,9 @@
 import os
+import io
 import sys
 from test.support import (run_unittest, TESTFN, rmtree, unlink,
                                captured_stdout)
+import tempfile
 import unittest
 
 import trace
@@ -361,6 +363,49 @@
         self.assertTrue(ignore.names(jn('bar', 'baz.py'), 'baz'))
 
 
+class TestDeprecatedMethods(unittest.TestCase):
+
+    def test_deprecated_usage(self):
+        sio = io.StringIO()
+        with self.assertWarns(DeprecationWarning):
+            trace.usage(sio)
+        self.assertIn('Usage:', sio.getvalue())
+
+    def test_deprecated_Ignore(self):
+        with self.assertWarns(DeprecationWarning):
+            trace.Ignore()
+
+    def test_deprecated_modname(self):
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual("spam", trace.modname("spam"))
+
+    def test_deprecated_fullmodname(self):
+        with self.assertWarns(DeprecationWarning):
+            self.assertEqual("spam", trace.fullmodname("spam"))
+
+    def test_deprecated_find_lines_from_code(self):
+        with self.assertWarns(DeprecationWarning):
+            def foo():
+                pass
+            trace.find_lines_from_code(foo.__code__, ["eggs"])
+
+    def test_deprecated_find_lines(self):
+        with self.assertWarns(DeprecationWarning):
+            def foo():
+                pass
+            trace.find_lines(foo.__code__, ["eggs"])
+
+    def test_deprecated_find_strings(self):
+        with self.assertWarns(DeprecationWarning):
+            with tempfile.NamedTemporaryFile() as fd:
+                trace.find_strings(fd.name)
+
+    def test_deprecated_find_executable_linenos(self):
+        with self.assertWarns(DeprecationWarning):
+            with tempfile.NamedTemporaryFile() as fd:
+                trace.find_executable_linenos(fd.name)
+
+
 def test_main():
     run_unittest(__name__)
 
diff --git a/Lib/trace.py b/Lib/trace.py
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -58,6 +58,7 @@
 import gc
 import dis
 import pickle
+from warnings import warn as _warn
 try:
     from time import monotonic as _time
 except ImportError:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -253,6 +253,9 @@
 Library
 -------
 
+- Issue #17143: Fix a missing import in the trace module.  Initial patch by
+  Berker Peksag.
+
 - Issue #15220: email.feedparser's line splitting algorithm is now simpler and
   faster.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list