From c167eaa1a0752f97322490a92b8f2bc4e8531812 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Mon, 21 Sep 2015 10:52:15 +0000 Subject: Improve the test suite for deprecated-method --- pylint/checkers/stdlib.py | 2 +- pylint/test/functional/deprecated_methods_py2.py | 6 +++--- pylint/test/functional/deprecated_methods_py3.py | 21 +++++++++++++++++---- pylint/test/functional/deprecated_methods_py3.rc | 2 +- pylint/test/functional/deprecated_methods_py3.txt | 16 +++++++++++++--- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py index b7548e7..9519cd6 100644 --- a/pylint/checkers/stdlib.py +++ b/pylint/checkers/stdlib.py @@ -177,7 +177,7 @@ class StdlibChecker(BaseChecker): 'inspect.getmoduleinfo', 'inspect.getmodulename', 'logging.warn', 'logging.Logger.warn', 'logging.LoggerAdapter.warn', - 'nntplib.NNTPBase.xpath', + 'nntplib._NNTPBase.xpath', 'platform.popen', ], (3, 4): [ diff --git a/pylint/test/functional/deprecated_methods_py2.py b/pylint/test/functional/deprecated_methods_py2.py index 3b3d25a..ceba1e4 100644 --- a/pylint/test/functional/deprecated_methods_py2.py +++ b/pylint/test/functional/deprecated_methods_py2.py @@ -3,7 +3,7 @@ import os import xml.etree.ElementTree -os.popen2() # [deprecated-method] -os.popen3() # [deprecated-method] -os.popen4() # [deprecated-method] +os.popen2('') # [deprecated-method] +os.popen3('') # [deprecated-method] +os.popen4('') # [deprecated-method] xml.etree.ElementTree.Element('elem').getchildren() # [deprecated-method] diff --git a/pylint/test/functional/deprecated_methods_py3.py b/pylint/test/functional/deprecated_methods_py3.py index 1a5fbf0..214964b 100644 --- a/pylint/test/functional/deprecated_methods_py3.py +++ b/pylint/test/functional/deprecated_methods_py3.py @@ -1,7 +1,12 @@ """ Functional tests for method deprecation. """ # pylint: disable=missing-docstring +import base64 +import cgi +import inspect +import logging +import nntplib +import platform import unittest -import distutils import xml.etree.ElementTree @@ -9,7 +14,15 @@ class MyTest(unittest.TestCase): def test(self): self.assert_(True) # [deprecated-method] -REG = distutils.command.register.register('a') -REG.check_metadata() # [deprecated-method] - xml.etree.ElementTree.Element('tag').getchildren() # [deprecated-method] +xml.etree.ElementTree.Element('tag').getiterator() # [deprecated-method] +xml.etree.ElementTree.XMLParser('tag', None, None).doctype(None, None, None) # [deprecated-method] +nntplib.NNTP(None).xpath(None) # [deprecated-method] +inspect.getmoduleinfo(inspect) # [deprecated-method] +inspect.getmodulename(inspect) # [deprecated-method] +inspect.getargspec(None) # [deprecated-method] +logging.warn("a") # [deprecated-method] +platform.popen([]) # [deprecated-method] +base64.encodestring("42") # [deprecated-method] +base64.decodestring("42") # [deprecated-method] +cgi.escape("a") # [deprecated-method] diff --git a/pylint/test/functional/deprecated_methods_py3.rc b/pylint/test/functional/deprecated_methods_py3.rc index c093be2..28c99bc 100644 --- a/pylint/test/functional/deprecated_methods_py3.rc +++ b/pylint/test/functional/deprecated_methods_py3.rc @@ -1,2 +1,2 @@ [testoptions] -min_pyver=3.0 +min_pyver=3.3 diff --git a/pylint/test/functional/deprecated_methods_py3.txt b/pylint/test/functional/deprecated_methods_py3.txt index 8e9516c..29a2ce8 100644 --- a/pylint/test/functional/deprecated_methods_py3.txt +++ b/pylint/test/functional/deprecated_methods_py3.txt @@ -1,3 +1,13 @@ -deprecated-method:10:MyTest.test:Using deprecated method assert_() -deprecated-method:13::Using deprecated method check_metadata() -deprecated-method:15::Using deprecated method getchildren() +deprecated-method:15:MyTest.test:Using deprecated method assert_() +deprecated-method:17::Using deprecated method getchildren() +deprecated-method:18::Using deprecated method getiterator() +deprecated-method:19::Using deprecated method doctype() +deprecated-method:20::Using deprecated method xpath() +deprecated-method:21::Using deprecated method getmoduleinfo() +deprecated-method:22::Using deprecated method getmodulename() +deprecated-method:23::Using deprecated method getargspec() +deprecated-method:24::Using deprecated method warn() +deprecated-method:25::Using deprecated method popen() +deprecated-method:26::Using deprecated method encodestring() +deprecated-method:27::Using deprecated method decodestring() +deprecated-method:28::Using deprecated method escape() -- cgit v1.2.1