Fix a few pylint issues and only run the pylint test if mentioned in the nosetest arguments.

bzr-revno: 2684
This commit is contained in:
second@tgc.dk 2016-08-02 22:16:27 +02:00 committed by Tomas Groth
commit 5f73d3514c
4 changed files with 19 additions and 6 deletions

View File

@ -167,7 +167,7 @@ class ScreenList(object):
:param number: The screen number (int). :param number: The screen number (int).
""" """
log.info('remove_screen {number:d}'.forma(number=number)) log.info('remove_screen {number:d}'.format(number=number))
for screen in self.screen_list: for screen in self.screen_list:
if screen['number'] == number: if screen['number'] == number:
self.screen_list.remove(screen) self.screen_list.remove(screen)

View File

@ -458,7 +458,7 @@ class OpenLyrics(object):
self._add_tag_to_formatting(tag, tags_element) self._add_tag_to_formatting(tag, tags_element)
# Replace end tags. # Replace end tags.
for tag in end_tags: for tag in end_tags:
text = text.replace('{/{tag}}}'.format(tag=tag), '</tag>') text = text.replace('{{{tag}}}'.format(tag=tag), '</tag>')
# Replace \n with <br/>. # Replace \n with <br/>.
text = text.replace('\n', '<br/>') text = text.replace('\n', '<br/>')
element = etree.XML('<lines>{text}</lines>'.format(text=text)) element = etree.XML('<lines>{text}</lines>'.format(text=text))
@ -643,7 +643,7 @@ class OpenLyrics(object):
# Append text from tail and add formatting end tag. # Append text from tail and add formatting end tag.
# TODO: Verify format() with template variables # TODO: Verify format() with template variables
if element.tag == NSMAP % 'tag' and use_endtag: if element.tag == NSMAP % 'tag' and use_endtag:
text += '{/{name}}}'.format(name=element.get('name')) text += '{{{name}}}'.format(name=element.get('name'))
# Append text from tail. # Append text from tail.
if element.tail: if element.tail:
text += element.tail text += element.tail

View File

@ -63,9 +63,10 @@ class OpenLPJobs(object):
Branch_Windows_Interface = 'Branch-04b-Windows_Interface_Tests' Branch_Windows_Interface = 'Branch-04b-Windows_Interface_Tests'
Branch_PEP = 'Branch-05a-Code_Analysis' Branch_PEP = 'Branch-05a-Code_Analysis'
Branch_Coverage = 'Branch-05b-Test_Coverage' Branch_Coverage = 'Branch-05b-Test_Coverage'
Branch_Pylint = 'Branch-05c-Code_Analysis2'
Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_Windows_Functional, Branch_Windows_Interface, Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_Windows_Functional, Branch_Windows_Interface,
Branch_PEP, Branch_Coverage] Branch_PEP, Branch_Coverage, Branch_Pylint]
class Colour(object): class Colour(object):

View File

@ -23,8 +23,8 @@
Package to test for proper bzr tags. Package to test for proper bzr tags.
""" """
import os import os
import logging
import platform import platform
import sys
from unittest import TestCase, SkipTest from unittest import TestCase, SkipTest
try: try:
@ -46,9 +46,18 @@ class TestPylint(TestCase):
""" """
Test for pylint errors Test for pylint errors
""" """
# Test if this file is specified in the arguments, if not skip the test.
in_argv = False
for arg in sys.argv:
if arg.endswith('test_pylint.py') or arg.endswith('test_pylint'):
in_argv = True
break
if not in_argv:
raise SkipTest('test_pylint.py not specified in arguments - skipping tests using pylint.')
# GIVEN: Some checks to disable and enable, and the pylint script # GIVEN: Some checks to disable and enable, and the pylint script
disabled_checks = 'import-error,no-member' disabled_checks = 'import-error,no-member'
enabled_checks = 'missing-format-argument-key,unused-format-string-argument' enabled_checks = 'missing-format-argument-key,unused-format-string-argument,bad-format-string'
if is_win() or 'arch' in platform.dist()[0].lower(): if is_win() or 'arch' in platform.dist()[0].lower():
pylint_script = 'pylint' pylint_script = 'pylint'
else: else:
@ -84,6 +93,9 @@ class TestPylint(TestCase):
# Filter out PyQt related errors # Filter out PyQt related errors
elif ('no-name-in-module' in line or 'no-member' in line) and 'PyQt5' in line: elif ('no-name-in-module' in line or 'no-member' in line) and 'PyQt5' in line:
continue continue
# Filter out distutils related errors
elif 'distutils' in line:
continue
elif self._is_line_tolerated(line): elif self._is_line_tolerated(line):
continue continue
else: else: