mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
#17143: fix a missing import in the trace module. Initial patch by Berker Peksag.
This commit is contained in:
parent
3a03d2eaef
commit
23e043fdcd
3 changed files with 49 additions and 0 deletions
|
@ -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 @@ class Test_Ignore(unittest.TestCase):
|
|||
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__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue