Bug 1407763 - Fix lint/import errors r?whimboo draft
authorMike Yusko <freshjelly12@yahoo.com>
Thu, 21 Dec 2017 23:12:12 +0200
changeset 714153 4a7f406b232406a24de47006611567569a65a579
parent 709035 ea0f3f5ab9df9c5117d6b815fa80aff5d45c2349
child 744545 1e9f4a4ec24473b2f13a11d9e48be61706462b05
push id93873
push userbmo:freshjelly12@yahoo.com
push dateThu, 21 Dec 2017 21:31:04 +0000
reviewerswhimboo
bugs1407763
milestone59.0a1
Bug 1407763 - Fix lint/import errors r?whimboo MozReview-Commit-ID: ECCNHZVRfPe
npm-shrinkwrap.json
testing/marionette/client/marionette_driver/__init__.py
testing/marionette/client/marionette_driver/expected.py
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/client/marionette_driver/gestures.py
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/client/marionette_driver/timeout.py
testing/marionette/client/marionette_driver/wait.py
testing/marionette/harness/marionette_harness/__init__.py
testing/marionette/harness/marionette_harness/marionette_test/__init__.py
testing/marionette/harness/marionette_harness/runner/base.py
testing/marionette/harness/marionette_harness/runner/httpd.py
testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/__init__.py
testing/marionette/harness/marionette_harness/runner/serve.py
testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
testing/marionette/harness/marionette_harness/tests/unit/test_expected.py
testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
testing/marionette/mach_commands.py
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -1,10 +1,11 @@
 {
   "name": "mozillaeslintsetup",
+  "requires": true,
   "lockfileVersion": 1,
   "dependencies": {
     "acorn": {
       "version": "5.2.1",
       "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
       "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w=="
     },
     "acorn-jsx": {
@@ -452,17 +453,21 @@
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-4.0.0.tgz",
       "integrity": "sha512-xK/909qOTq5JVzuO2jo4a24nQcWhkOBz9dOIkORvB7RxC75a4b6B9wFpBXAl8WDhwJGFDj5gBDRN+/L3kK/ghw==",
       "requires": {
         "htmlparser2": "3.9.2"
       }
     },
     "eslint-plugin-mozilla": {
-      "version": "file:tools/lint/eslint/eslint-plugin-mozilla"
+      "version": "file:tools/lint/eslint/eslint-plugin-mozilla",
+      "requires": {
+        "ini-parser": "0.0.2",
+        "sax": "1.2.4"
+      }
     },
     "eslint-plugin-no-unsanitized": {
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-2.0.1.tgz",
       "integrity": "sha1-yt7dDQrRfI3FIm23/4hATlmo1n8=",
       "requires": {
         "eslint": "3.19.0"
       },
@@ -1426,33 +1431,33 @@
         "is-fullwidth-code-point": "2.0.0"
       }
     },
     "sprintf-js": {
       "version": "1.0.3",
       "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
       "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw="
     },
-    "string_decoder": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
-      "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
-      "requires": {
-        "safe-buffer": "5.1.1"
-      }
-    },
     "string-width": {
       "version": "2.1.1",
       "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
       "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
       "requires": {
         "is-fullwidth-code-point": "2.0.0",
         "strip-ansi": "4.0.0"
       }
     },
+    "string_decoder": {
+      "version": "1.0.3",
+      "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz",
+      "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==",
+      "requires": {
+        "safe-buffer": "5.1.1"
+      }
+    },
     "strip-ansi": {
       "version": "4.0.0",
       "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
       "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
       "requires": {
         "ansi-regex": "3.0.0"
       },
       "dependencies": {
@@ -1572,9 +1577,9 @@
       "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
     },
     "yallist": {
       "version": "2.1.2",
       "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz",
       "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI="
     }
   }
-}
+}
\ No newline at end of file
--- a/testing/marionette/client/marionette_driver/__init__.py
+++ b/testing/marionette/client/marionette_driver/__init__.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-__version__ = '2.5.0'
+from __future__ import absolute_import
 
-from __future__ import absolute_import
+__version__ = '2.5.0'
 
 from marionette_driver import (
     addons,
     by,
     date_time_value,
     decorators,
     errors,
     expected,
--- a/testing/marionette/client/marionette_driver/expected.py
+++ b/testing/marionette/client/marionette_driver/expected.py
@@ -1,18 +1,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
-import errors
 import types
+from . import errors
 
-from marionette import HTMLElement
+from .marionette import HTMLElement
 
 """This file provides a set of expected conditions for common use
 cases when writing Marionette tests.
 
 The conditions rely on explicit waits that retries conditions a number
 of times until they are either successfully met, or they time out.
 
 """
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -349,17 +349,17 @@ class FennecInstance(GeckoInstance):
         self.runner = self.runner_class(**self._get_runner_args())
         try:
             if self.connect_to_running_emulator:
                 self.runner.device.connect()
             self.runner.start()
         except Exception as e:
             exc, val, tb = sys.exc_info()
             message = "Error possibly due to runner or device args: {}"
-            raise (exc, message.format(e.message), tb)
+            raise exc(message.format(e.message), tb)
         # gecko_log comes from logcat when running with device/emulator
         logcat_args = {
             "filterspec": "Gecko",
             "serial": self.runner.device.dm._deviceSerial
         }
         if self.gecko_log == "-":
             logcat_args["stream"] = sys.stdout
         else:
--- a/testing/marionette/client/marionette_driver/gestures.py
+++ b/testing/marionette/client/marionette_driver/gestures.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
-from marionette import MultiActions, Actions
+from .marionette import MultiActions, Actions
 
 
 def smooth_scroll(marionette_session, start_element, axis, direction,
                   length, increments=None, wait_period=None, scroll_back=None):
     """
         :param axis:  y or x
         :param direction: 0 for positive, and -1 for negative
         :param length: total length of scroll scroll
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -11,18 +11,18 @@ import os
 import socket
 import sys
 import time
 import traceback
 import warnings
 
 from contextlib import contextmanager
 
-import errors
-import transport
+from . import errors
+from . import transport
 
 from .decorators import do_process_check
 from .geckoinstance import GeckoInstance
 from .keys import Keys
 from .timeout import Timeouts
 
 WEBELEMENT_KEY = "ELEMENT"
 W3C_WEBELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf"
@@ -790,17 +790,17 @@ class Marionette(object):
         frame, and is only called via the `@do_process_check` decorator.
 
         """
         exc, val, tb = sys.exc_info()
 
         # If the application hasn't been launched by Marionette no further action can be done.
         # In such cases we simply re-throw the exception.
         if not self.instance:
-            raise(exc, val, tb)
+            raise exc(val, tb)
 
         else:
             # Somehow the socket disconnected. Give the application some time to shutdown
             # itself before killing the process.
             returncode = self.instance.runner.wait(timeout=self.DEFAULT_SHUTDOWN_TIMEOUT)
 
             if returncode is None:
                 message = ('Process killed because the connection to Marionette server is '
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -1,16 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
 from __future__ import absolute_import
 
-import errors
+from . import errors
 
 
 DEFAULT_SCRIPT_TIMEOUT = 30
 DEFAULT_PAGE_LOAD_TIMEOUT = 300
 DEFAULT_IMPLICIT_WAIT_TIMEOUT = 0
 
 
 class Timeouts(object):
--- a/testing/marionette/client/marionette_driver/wait.py
+++ b/testing/marionette/client/marionette_driver/wait.py
@@ -1,16 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import
 
 import collections
-import errors
+from . import errors
 import sys
 import time
 
 DEFAULT_TIMEOUT = 5
 DEFAULT_INTERVAL = 0.1
 
 
 class Wait(object):
--- a/testing/marionette/harness/marionette_harness/__init__.py
+++ b/testing/marionette/harness/marionette_harness/__init__.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-__version__ = '4.3.0'
+from __future__ import absolute_import
 
-from __future__ import absolute_import
+__version__ = '4.3.0'
 
 from .marionette_test import (
     CommonTestCase,
     expectedFailure,
     MarionetteTestCase,
     parameterized,
     run_if_e10s,
     run_if_manage_instance,
--- a/testing/marionette/harness/marionette_harness/marionette_test/__init__.py
+++ b/testing/marionette/harness/marionette_harness/marionette_test/__init__.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-__version__ = '3.1.0'
+from __future__ import absolute_import
 
-from __future__ import absolute_import
+__version__ = '3.1.0'
 
 from unittest.case import (
     expectedFailure,
     skip,
     SkipTest,
 )
 
 from .decorators import (
--- a/testing/marionette/harness/marionette_harness/runner/base.py
+++ b/testing/marionette/harness/marionette_harness/runner/base.py
@@ -17,24 +17,24 @@ import unittest
 from argparse import ArgumentParser
 from collections import defaultdict
 from copy import deepcopy
 
 import mozinfo
 import moznetwork
 import mozprofile
 import mozversion
-import serve
+from . import serve
 
 from manifestparser import TestManifest
 from manifestparser.filters import tags
 from marionette_driver.marionette import Marionette
 from moztest.adapters.unit import StructuredTestResult, StructuredTestRunner
 from moztest.results import TestResult, TestResultCollection, relevant_line
-from serve import iter_proc, iter_url
+from .serve import iter_proc, iter_url
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 
 def update_mozinfo(path=None):
     """Walk up directories to find mozinfo.json and update the info."""
     path = path or here
     dirs = set()
@@ -914,17 +914,17 @@ class BaseMarionetteTestRunner(object):
             # raise only the exception if we were not interrupted
             if not interrupted:
                 raise
         finally:
             self.cleanup()
 
             # reraise previous interruption now
             if interrupted:
-                raise(interrupted[0], interrupted[1], interrupted[2])
+                raise interrupted[0](interrupted[1], interrupted[2])
 
     def _print_summary(self, tests):
         self.logger.info('\nSUMMARY\n-------')
         self.logger.info('passed: {}'.format(self.passed))
         if self.unexpected_successes == 0:
             self.logger.info('failed: {}'.format(self.failed))
         else:
             self.logger.info(
--- a/testing/marionette/harness/marionette_harness/runner/httpd.py
+++ b/testing/marionette/harness/marionette_harness/runner/httpd.py
@@ -174,11 +174,13 @@ e.g. \"https://0.0.0.0:0/base/\"""")
         "-k", dest="ssl_key", default=default_ssl_key,
         help="path to SSL certificate key (default %(default)s)")
     args = parser.parse_args()
 
     httpd = FixtureServer(args.doc_root, args.url,
                           ssl_cert=args.ssl_cert,
                           ssl_key=args.ssl_key)
     httpd.start()
-    print >>sys.stderr, "%s: started fixture server on %s" % \
-        (sys.argv[0], httpd.get_url("/"))
+    print(
+        sys.stderr,
+        "%s: started fixture server on %s" % (sys.argv[0], httpd.get_url("/"))
+        )
     httpd.wait()
--- a/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/__init__.py
+++ b/testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py/browsermobproxy/__init__.py
@@ -1,8 +1,8 @@
-__version__ = '0.5.0'
+from __future__ import absolute_import
 
-from __future__ import absolute_import
+__version__ = '0.5.0'
 
 from .server import Server
 from .client import Client
 
 __all__ = ['Server', 'Client', 'browsermobproxy']
--- a/testing/marionette/harness/marionette_harness/runner/serve.py
+++ b/testing/marionette/harness/marionette_harness/runner/serve.py
@@ -16,17 +16,17 @@ from __future__ import (
 
 import argparse
 import multiprocessing
 import os
 import sys
 
 from collections import defaultdict
 
-import httpd
+from . import httpd
 
 
 __all__ = ["default_doc_root",
            "iter_proc",
            "iter_url",
            "registered_servers",
            "servers",
            "start",
@@ -212,17 +212,17 @@ def main(args):
 
     parser = argparse.ArgumentParser()
     parser.add_argument("-r", dest="doc_root",
                         help="Path to document root.  Overrides default.")
     args = parser.parse_args()
 
     servers = start(args.doc_root)
     for url in iter_url(servers):
-        print >>sys.stderr, "{}: listening on {}".format(sys.argv[0], url)
+        print(sys.stderr, "{}: listening on {}".format(sys.argv[0], url))
 
     try:
         while any(proc.is_alive for proc in iter_proc(servers)):
             for proc in iter_proc(servers):
                 proc.proc.join(1)
     except KeyboardInterrupt:
         for proc in iter_proc(servers):
             proc.kill()
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -1,14 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import (
-    absolute_import, 
+    absolute_import,
     print_function
 )
 
 from marionette_driver.errors import SessionNotCreatedException
 
 from marionette_harness import MarionetteTestCase
 
 # Unlike python 3, python 2 doesn't have a proper implementation of realpath or
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_expected.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_expected.py
@@ -1,15 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import urllib
 
-from __future__ import absolute_import 
 from marionette_driver import expected
 from marionette_driver.by import By
 
 from marionette_harness import marionette_test
 
 
 def inline(doc):
     return "data:text/html;charset=utf-8,{}".format(urllib.quote(doc))
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_key_actions.py
@@ -1,15 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-import urllib
+from __future__ import absolute_import
 
-from __future__ import absolute_import
+import urllib
 
 from marionette_driver.by import By
 from marionette_driver.keys import Keys
 from marionette_driver.marionette import Actions
 
 from marionette_harness import MarionetteTestCase, skip_if_mobile, WindowManagerMixin
 
 
--- a/testing/marionette/mach_commands.py
+++ b/testing/marionette/mach_commands.py
@@ -78,18 +78,18 @@ class MachCommands(MachCommandBase):
 
     @Command("marionette-test",
              category="testing",
              description="Remote control protocol to Gecko, used for functional UI tests and browser automation.",
              conditions=[is_firefox_or_android],
              parser=create_parser_tests,
              )
     def run_marionette_test(self, tests, **kwargs):
-        print >>sys.stderr, ("warning: ./mach marionette-test is deprecated; "
-                             "please use ./mach marionette test")
+        print (sys.stderr, ("warning: ./mach marionette-test is deprecated; "
+                             "please use ./mach marionette test"))
 
         if "test_objects" in kwargs:
             tests = []
             for obj in kwargs["test_objects"]:
                 tests.append(obj["file_relpath"])
             del kwargs["test_objects"]
 
         if not kwargs.get("binary") and conditions.is_firefox(self):