Bug 1280573 - Add testing/mozbase to flake8 linter: r?ahal draft
authorFrancesco Pischedda <francesco.pischedda@gmail.com>
Fri, 30 Sep 2016 16:08:37 +0200
changeset 419510 3994749e3331
parent 419509 ee660a8a3a19
child 532589 36025983d377
push id30947
push userbmo:francesco.pischedda@gmail.com
push dateFri, 30 Sep 2016 14:09:10 +0000
reviewersahal
bugs1280573, 315962
milestone52.0a1
Bug 1280573 - Add testing/mozbase to flake8 linter: r?ahal rebased from 315962:5ffed033557e latest changes from mozilla-central MozReview-Commit-ID: FQ31GckJypQ
testing/mozbase/manifestparser/tests/test_convert_directory.py
testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py
--- a/testing/mozbase/manifestparser/tests/test_convert_directory.py
+++ b/testing/mozbase/manifestparser/tests/test_convert_directory.py
@@ -66,17 +66,17 @@ subsuite =
 subsuite = 
 
 [%(stub)s/foo]
 subsuite = 
 
 [%(stub)s/subdir/subfile]
 subsuite = 
 
-"""
+""" # noqa
             self.assertEqual(str(manifest), out_tmpl % dict(stub=stub))
         except:
             raise
         finally:
             shutil.rmtree(stub)  # cleanup
 
     def test_convert_directory_manifests_in_place(self):
         """
--- a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py
+++ b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py
@@ -3,16 +3,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import functools
 from collections import deque
 
 from .base import BaseFormatter
 from .process import strstatus
 
+
 def output_subtests(func):
     @functools.wraps(func)
     def inner(self, data):
         if self.subtests_count:
             return self._format_subtests(data.get("component")) + func(self, data)
         else:
             return func(self, data)
     return inner
@@ -186,24 +187,26 @@ class TbplFormatter(BaseFormatter):
                 message += "\n%s" % data["stack"]
             if message and message[-1] == "\n":
                 message = message[:-1]
 
             extra = data.get("extra", {})
             if "reftest_screenshots" in extra:
                 screenshots = extra["reftest_screenshots"]
                 if len(screenshots) == 3:
-                     message += ("\nREFTEST   IMAGE 1 (TEST): data:image/png;base64,%s\n"
-                                 "REFTEST   IMAGE 2 (REFERENCE): data:image/png;base64,%s") % (screenshots[0]["screenshot"],
-                                                                         screenshots[2]["screenshot"])
+                    message += ("\nREFTEST   IMAGE 1 (TEST): data:image/png;base64,%s\n"
+                                "REFTEST   IMAGE 2 (REFERENCE): data:image/png;base64,%s") % (
+                                    screenshots[0]["screenshot"],
+                                    screenshots[2]["screenshot"])
                 elif len(screenshots) == 1:
-                    message += "\nREFTEST   IMAGE: data:image/png;base64,%(image1)s" % screenshots[0]["screenshot"]
+                    message += "\nREFTEST   IMAGE: data:image/png;base64,%(image1)s" \
+                               % screenshots[0]["screenshot"]
 
             failure_line = "TEST-UNEXPECTED-%s | %s | %s\n" % (
-            data["status"], test_id, message)
+                data["status"], test_id, message)
 
             if data["expected"] not in ("PASS", "OK"):
                 expected_msg = "expected %s | " % data["expected"]
             else:
                 expected_msg = ""
             info_line = "TEST-INFO %s%s\n" % (expected_msg, duration_msg)
 
             return failure_line + info_line
@@ -233,9 +236,9 @@ class TbplFormatter(BaseFormatter):
             rv = rv + line + "\n"
 
         return rv
 
     def lint(self, data):
         fmt = "TEST-UNEXPECTED-{level} | {path}:{lineno}{column} | {message} ({rule})"
         data["column"] = ":%s" % data["column"] if data["column"] else ""
         data['rule'] = data['rule'] or data['linter'] or ""
-        message.append(fmt.format(**data))
+        return fmt.append(fmt.format(**data))