summaryrefslogtreecommitdiff
path: root/testutils.py
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-07-24 19:04:47 +0200
committerTorsten Marek <shlomme@gmail.com>2014-07-24 19:04:47 +0200
commitd76865583f0103915150ed901afeceba9f2eadba (patch)
tree13fdc313ec69358a16580f06b5e38d610ff65cb1 /testutils.py
parent328c824b73debaeee050f39043ba78b0b512ecc5 (diff)
downloadpylint-d76865583f0103915150ed901afeceba9f2eadba.tar.gz
Make pylint compatible with Python 2.5 again, and make all the tests pass (Closes: #278).
Diffstat (limited to 'testutils.py')
-rw-r--r--testutils.py28
1 files changed, 24 insertions, 4 deletions
diff --git a/testutils.py b/testutils.py
index daf7477..ef423c5 100644
--- a/testutils.py
+++ b/testutils.py
@@ -122,10 +122,30 @@ class TestReporter(BaseReporter):
"""ignore layouts"""
-class Message(collections.namedtuple('Message',
- ['msg_id', 'line', 'node', 'args'])):
- def __new__(cls, msg_id, line=None, node=None, args=None):
- return tuple.__new__(cls, (msg_id, line, node, args))
+if sys.version_info < (2, 6):
+ class Message(tuple):
+ def __new__(cls, msg_id, line=None, node=None, args=None):
+ return tuple.__new__(cls, (msg_id, line, node, args))
+
+ @property
+ def msg_id(self):
+ return self[0]
+ @property
+ def line(self):
+ return self[1]
+ @property
+ def node(self):
+ return self[2]
+ @property
+ def args(self):
+ return self[3]
+
+
+else:
+ class Message(collections.namedtuple('Message',
+ ['msg_id', 'line', 'node', 'args'])):
+ def __new__(cls, msg_id, line=None, node=None, args=None):
+ return tuple.__new__(cls, (msg_id, line, node, args))
class UnittestLinter(object):