← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~tomasgroth/openlp/pylint-fix into lp:openlp

 

Tomas Groth has proposed merging lp:~tomasgroth/openlp/pylint-fix into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/pylint-fix/+merge/301704

Fix a few pylint issues and only run the pylint test if mentioned in the nosetest arguments.
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~tomasgroth/openlp/pylint-fix into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/openlyricsxml.py'
--- openlp/plugins/songs/lib/openlyricsxml.py	2016-05-27 08:29:31 +0000
+++ openlp/plugins/songs/lib/openlyricsxml.py	2016-08-01 18:59:26 +0000
@@ -458,7 +458,7 @@
                 self._add_tag_to_formatting(tag, tags_element)
         # Replace 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/>.
         text = text.replace('\n', '<br/>')
         element = etree.XML('<lines>{text}</lines>'.format(text=text))
@@ -643,7 +643,7 @@
         # Append text from tail and add formatting end tag.
         # TODO: Verify format() with template variables
         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.
         if element.tail:
             text += element.tail

=== modified file 'tests/utils/test_pylint.py'
--- tests/utils/test_pylint.py	2016-07-06 19:48:57 +0000
+++ tests/utils/test_pylint.py	2016-08-01 18:59:26 +0000
@@ -23,8 +23,8 @@
 Package to test for proper bzr tags.
 """
 import os
-import logging
 import platform
+import sys
 from unittest import TestCase, SkipTest
 
 try:
@@ -35,6 +35,14 @@
 
 from openlp.core.common import is_win
 
+in_argv = False
+for arg in sys.argv:
+    if arg.endswith('test_pylint.py'):
+        in_argv = True
+        break
+if not in_argv:
+    raise SkipTest('test_pylint.py not specified in arguments - skipping tests using pylint.')
+
 TOLERATED_ERRORS = {'registryproperties.py': ['access-member-before-definition'],
                     'opensong.py': ['no-name-in-module'],
                     'maindisplay.py': ['no-name-in-module']}
@@ -48,7 +56,7 @@
         """
         # GIVEN: Some checks to disable and enable, and the pylint script
         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():
             pylint_script = 'pylint'
         else:
@@ -84,6 +92,9 @@
             # Filter out PyQt related errors
             elif ('no-name-in-module' in line or 'no-member' in line) and 'PyQt5' in line:
                 continue
+            # Filter out distutils related errors
+            elif 'distutils' in line:
+                continue
             elif self._is_line_tolerated(line):
                 continue
             else:


References