Changes to pylint test

This commit is contained in:
Tomas Groth 2016-07-05 22:30:33 +02:00
parent 8aa917c89c
commit 9294aadae9
1 changed files with 17 additions and 11 deletions

View File

@ -24,11 +24,14 @@ Package to test for proper bzr tags.
""" """
import os import os
import logging import logging
from unittest import TestCase import platform
from unittest import TestCase, SkipTest
try:
from pylint import epylint as lint from pylint import epylint as lint
from pylint.__pkginfo__ import pylint_version from pylint.__pkginfo__ import version
except ImportError:
raise SkipTest('pylint not installed - skipping tests using pylint.')
class TestPylint(TestCase): class TestPylint(TestCase):
@ -36,17 +39,20 @@ class TestPylint(TestCase):
""" """
Test for pylint errors Test for pylint errors
""" """
# GIVEN: The openlp base folder # GIVEN: Some checks to disable and enable, and the pylint script
disabled_checks = 'no-member,import-error,no-name-in-module'
enabled_checks = 'missing-format-argument-key,unused-format-string-argument' enabled_checks = 'missing-format-argument-key,unused-format-string-argument'
#disabled_checks = 'all' if 'arch' in platform.dist()[0].lower():
disabled_checks = '' pylint_script = 'pylint'
else:
pylint_script = 'pylint3'
# WHEN: Running pylint # WHEN: Running pylint
(pylint_stdout, pylint_stderr) = \ (pylint_stdout, pylint_stderr) = \
lint.py_run('{path} --disable={disabled} --enable={enabled} --reports=no'.format(path='openlp', lint.py_run('openlp --errors-only --disable={disabled} --enable={enabled} --reports=no --output-format=parseable'.format(
disabled=disabled_checks, disabled=disabled_checks,
enabled=enabled_checks), enabled=enabled_checks),
return_std=True, script='pylint3') return_std=True, script=pylint_script)
stdout = pylint_stdout.read() stdout = pylint_stdout.read()
stderr = pylint_stderr.read() stderr = pylint_stderr.read()
print(stdout) print(stdout)