Skip to content
Browse files
Introduce isinstance(cls, LinterClass)
Replace `hasattr(cls, 'process_output')` by
`isinstance(cls, LinterClass)` in `LocalBearTestHelper`.
Instead of checking `hasattr(cls, 'process_output')`, an
`isinstance(cls, LinterClass)` is safer and easier to understand.

Related to #4594
  • Loading branch information
yash-nisar committed Aug 2, 2017
1 parent 9f279e4 commit 2816dc6888b7ab27e60f721254f7085ee1020c62
Showing with 2 additions and 1 deletion.
  1. +2 −1 coalib/testing/
@@ -5,6 +5,7 @@

import pytest

from coalib.bearlib.abstractions.LinterClass import LinterClass
from coalib.testing.BearTestHelper import generate_skip_decorator
from coalib.bears.LocalBear import LocalBear
from coala_utils.ContextManagers import prepare_file
@@ -20,7 +21,7 @@ def execute_bear(bear, *args, **kwargs):
# For linters provide additional information, such as
# stdout and stderr.
with ExitStack() as stack:
if hasattr(bear, 'process_output'):
if isinstance(bear, LinterClass):
console_output.append('The program yielded '
'the following output:\n')
old_process_output = bear.process_output

0 comments on commit 2816dc6

Please sign in to comment.