Permalink
Browse files

ElmLintBear: Remove `pragma: no cover`

Remove `pragma: no cover` in `check_prerequisites` by adding
a suitable test.

Closes #1996
Related to #1618
  • Loading branch information...
yash-nisar committed Aug 14, 2017
1 parent cf4132a commit 0a25352953ee2b3d91e1350d50153e495fc203f2
Showing with 14 additions and 1 deletion.
  1. +1 −1 bears/elm/ElmLintBear.py
  2. +13 −0 tests/elm/ElmLintBearTest.py
View
@@ -24,7 +24,7 @@ class ElmLintBear:
CAN_DETECT = {'Syntax', 'Formatting'}
@classmethod
def check_prerequisites(cls): # pragma: no cover
def check_prerequisites(cls):
if which('elm-format') is None:
return ('elm-format is missing. Download it from '
'https://github.com/avh4/elm-format/blob/master/README.md'
@@ -1,4 +1,5 @@
from queue import Queue
from unittest.mock import patch
from bears.elm.ElmLintBear import ElmLintBear
from coalib.results.Result import Result
@@ -143,3 +144,15 @@ def test_good_function(self):
[],
filename=fname,
create_tempfile=False)
@patch('bears.elm.ElmLintBear.which')
def test_check_prerequisites(self, mock_method):
mock_method.return_value = None
self.assertEqual(
ElmLintBear.check_prerequisites(),
'elm-format is missing. Download it from '
'https://github.com/avh4/elm-format/blob/master/README.md'
'#for-elm-018 and put it into your PATH.')
mock_method.return_value = 'path/to/elm-format'
self.assertEqual(ElmLintBear.check_prerequisites(), True)

0 comments on commit 0a25352

Please sign in to comment.