diff options
| author | Torsten Marek <shlomme@gmail.com> | 2014-07-24 19:04:47 +0200 |
|---|---|---|
| committer | Torsten Marek <shlomme@gmail.com> | 2014-07-24 19:04:47 +0200 |
| commit | 9b8250c027f426c8b87693c36917d567a68ce314 (patch) | |
| tree | a4b65c61c402e72f8cb956e31ffcbf6091a5c727 /testutils.py | |
| parent | 26212418ee309b27978f00910c952bbf5e8bc815 (diff) | |
| download | pylint-git-9b8250c027f426c8b87693c36917d567a68ce314.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.py | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/testutils.py b/testutils.py index daf747781..ef423c543 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): |
