Skip to content

Commit

Permalink
Fix missing 'UnknownMessage' exception
Browse files Browse the repository at this point in the history
The recent 1.7 version of pylint moved the exceptions to a different
submodule and this ensures everything works as expected.
  • Loading branch information
sijis committed Apr 19, 2017
1 parent c893531 commit 13d7164
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion prospector/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-

try:
from pylint.utils import UnknownMessage as UnknownMessageError
except ImportError:
from pylint.exceptions import UnknownMessageError

class FatalProspectorException(Exception):

Expand Down
4 changes: 2 additions & 2 deletions prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import os
from pylint.config import find_pylintrc
from pylint.utils import UnknownMessage
from prospector.exceptions import UnknownMessageError
from prospector.message import Message, Location
from prospector.tools.base import ToolBase
from prospector.tools.pylint.collector import Collector
Expand Down Expand Up @@ -41,7 +41,7 @@ def _prospector_configure(self, prospector_config, linter):
try:
linter.disable(msg_id)
# pylint: disable=pointless-except
except UnknownMessage:
except UnknownMessageError:
# If the msg_id doesn't exist in PyLint any more,
# don't worry about it.
pass
Expand Down
4 changes: 2 additions & 2 deletions prospector/tools/pylint/collector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import
from pylint.reporters import BaseReporter
from pylint.utils import UnknownMessage
from prospector.exceptions import UnknownMessageError
from prospector.message import Location, Message


Expand All @@ -20,7 +20,7 @@ def add_message(self, msg_id, location, msg):
# more user-friendly symbol
try:
msg_data = self._message_store.check_message_id(msg_id)
except UnknownMessage:
except UnknownMessageError:
# this shouldn't happen, as all pylint errors should be
# in the message store, but just in case we'll fall back
# to using the code.
Expand Down

0 comments on commit 13d7164

Please sign in to comment.