summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-01-03 10:25:03 +0200
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-01-03 10:25:03 +0200
commit81a9fe1cde3895a0df9a8bcebe05eae6cac3226f (patch)
treedf9e0cc9c4b53048f096169e1f05e6056c5a508c
parent1e575a772d1e52af0b04828c7401569755663578 (diff)
downloadpylint-81a9fe1cde3895a0df9a8bcebe05eae6cac3226f.tar.gz
Use a DeprecationWarning for ParseableTextReporter.
-rw-r--r--reporters/text.py3
-rw-r--r--test/unittest_reporting.py13
2 files changed, 14 insertions, 2 deletions
diff --git a/reporters/text.py b/reporters/text.py
index bc86313..53c4a8d 100644
--- a/reporters/text.py
+++ b/reporters/text.py
@@ -77,7 +77,8 @@ class ParseableTextReporter(TextReporter):
def __init__(self, output=None):
warnings.warn('%s output format is deprecated. This is equivalent '
- 'to --msg-template=%s' % (self.name, self.line_format))
+ 'to --msg-template=%s' % (self.name, self.line_format),
+ DeprecationWarning)
TextReporter.__init__(self, output)
diff --git a/test/unittest_reporting.py b/test/unittest_reporting.py
index 1850a98..af5a69b 100644
--- a/test/unittest_reporting.py
+++ b/test/unittest_reporting.py
@@ -14,6 +14,7 @@
import os
from os.path import join, dirname, abspath
import unittest
+import warnings
import six
@@ -49,9 +50,19 @@ class PyLinterTC(unittest.TestCase):
'C0301:001\n'
'C0301:002\n')
+ def test_parseable_output_deprecated(self):
+ with warnings.catch_warnings(record=True) as cm:
+ warnings.simplefilter("always")
+ ParseableTextReporter()
+
+ self.assertEqual(len(cm), 1)
+ self.assertIsInstance(cm[0].message, DeprecationWarning)
+
def test_parseable_output_regression(self):
output = six.StringIO()
- linter = PyLinter(reporter=ParseableTextReporter())
+ with warnings.catch_warnings(record=True):
+ linter = PyLinter(reporter=ParseableTextReporter())
+
checkers.initialize(linter)
linter.config.persistent = 0
linter.reporter.set_output(output)