"BUG 1274167" Added Linter(flake8) support for Firefox-ui and Puppeteer draft
authorPiyush Sinha <sinha.piyush0609@gmail.com>
Thu, 04 Aug 2016 03:38:29 +0530
changeset 396489 d0f4ae53c1581fefa93cd5c80d23c443425ed61f
parent 396488 d1a28ab51ce70fa83943803d374e69396faaa54d
child 396735 8ef7f2edc082a6de2fbec55904286705a41fcfc1
push id25018
push userbmo:sinha.piyush0609@gmail.com
push dateWed, 03 Aug 2016 22:23:51 +0000
bugs1274167
milestone51.0a1
"BUG 1274167" Added Linter(flake8) support for Firefox-ui and Puppeteer MozReview-Commit-ID: 8lShzyk1upH
testing/firefox-ui/harness/firefox_ui_harness/__init__.py
testing/firefox-ui/harness/firefox_ui_harness/arguments/__init__.py
testing/firefox-ui/harness/firefox_ui_harness/runners/__init__.py
testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
testing/firefox-ui/tests/functional/sessionstore/test_restore_windows_after_restart.py
testing/firefox-ui/tests/puppeteer/test_appinfo.py
testing/firefox-ui/tests/puppeteer/test_menubar.py
testing/firefox-ui/tests/puppeteer/test_page_info_window.py
testing/firefox-ui/tests/puppeteer/test_windows.py
testing/puppeteer/firefox/firefox_puppeteer/__init__.py
testing/puppeteer/firefox/firefox_puppeteer/testcases/__init__.py
testing/puppeteer/firefox/firefox_puppeteer/testcases/base.py
testing/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/__init__.py
--- a/testing/firefox-ui/harness/firefox_ui_harness/__init__.py
+++ b/testing/firefox-ui/harness/firefox_ui_harness/__init__.py
@@ -1,8 +1,8 @@
 # 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__ = '1.4.0'
 
-import cli_functional
-import cli_update
+# import cli_functional
+# import cli_update
--- a/testing/firefox-ui/harness/firefox_ui_harness/arguments/__init__.py
+++ b/testing/firefox-ui/harness/firefox_ui_harness/arguments/__init__.py
@@ -1,6 +1,6 @@
 # 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 firefox_ui_harness.arguments.base import FirefoxUIArguments
-from firefox_ui_harness.arguments.update import UpdateArguments
+# from firefox_ui_harness.arguments.base import FirefoxUIArguments
+# from firefox_ui_harness.arguments.update import UpdateArguments
--- a/testing/firefox-ui/harness/firefox_ui_harness/runners/__init__.py
+++ b/testing/firefox-ui/harness/firefox_ui_harness/runners/__init__.py
@@ -1,6 +1,6 @@
 # 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 firefox_ui_harness.runners.base import FirefoxUITestRunner
-from firefox_ui_harness.runners.update import UpdateTestRunner
+# from firefox_ui_harness.runners.base import FirefoxUITestRunner
+# from firefox_ui_harness.runners.update import UpdateTestRunner
--- a/testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
+++ b/testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
@@ -1,13 +1,13 @@
 # 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 marionette_driver import Wait
+# from marionette_driver import Wait
 
 from firefox_ui_harness.testcases import FirefoxTestCase
 
 
 class TestMixedContentPage(FirefoxTestCase):
     def setUp(self):
         FirefoxTestCase.setUp(self)
 
--- a/testing/firefox-ui/tests/functional/sessionstore/test_restore_windows_after_restart.py
+++ b/testing/firefox-ui/tests/functional/sessionstore/test_restore_windows_after_restart.py
@@ -120,17 +120,16 @@ class TestRestoreWindowsAfterRestart(Fir
             win = self.browser
 
         for index, urls in enumerate(window_sets):
             if index > 0:
                 win = self.browser.open_browser(is_private=is_private)
             win.switch_to()
             self.open_tabs(win, urls)
 
-
     def open_tabs(self, win, urls):
         """ Opens a set of URLs inside a window in new tabs.
 
         @param win (browser window)
                The browser window to load the tabs in.
         @param urls (tuple)
                A tuple of URLs to load in this window. The
                first URL will be loaded in the currently selected
--- a/testing/firefox-ui/tests/puppeteer/test_appinfo.py
+++ b/testing/firefox-ui/tests/puppeteer/test_appinfo.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/.
 
 import mozversion
-from marionette_driver.errors import MarionetteException
+# from marionette_driver.errors import MarionetteException
 
 from firefox_ui_harness.testcases import FirefoxTestCase
 
 
 class TestAppInfo(FirefoxTestCase):
 
     def test_valid_properties(self):
         binary = self.marionette.bin
--- a/testing/firefox-ui/tests/puppeteer/test_menubar.py
+++ b/testing/firefox-ui/tests/puppeteer/test_menubar.py
@@ -8,17 +8,17 @@ from firefox_ui_harness.testcases import
 
 
 class TestMenuBar(FirefoxTestCase):
 
     def setUp(self):
         FirefoxTestCase.setUp(self)
 
     def test_click_item_in_menubar(self):
-        num_tabs = len(self.browser.tabbar.tabs)
+        # num_tabs = len(self.browser.tabbar.tabs)
 
         def opener(_):
             self.browser.menubar.select_by_id('file-menu',
                                               'menu_newNavigatorTab')
 
         self.browser.tabbar.open_tab(trigger=opener)
 
         self.browser.tabbar.tabs[-1].close()
--- a/testing/firefox-ui/tests/puppeteer/test_page_info_window.py
+++ b/testing/firefox-ui/tests/puppeteer/test_page_info_window.py
@@ -1,13 +1,13 @@
 # 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 marionette_driver import By
+# from marionette_driver import By
 from firefox_ui_harness.testcases import FirefoxTestCase
 
 
 class TestPageInfoWindow(FirefoxTestCase):
 
     def tearDown(self):
         try:
             self.windows.close_all([self.browser])
--- a/testing/firefox-ui/tests/puppeteer/test_windows.py
+++ b/testing/firefox-ui/tests/puppeteer/test_windows.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 marionette_driver import By, Wait
-from marionette_driver.errors import NoSuchWindowException, TimeoutException
+from marionette_driver.errors import NoSuchWindowException
 
 import firefox_puppeteer.errors as errors
 
 from firefox_puppeteer.ui.windows import BaseWindow
 from firefox_ui_harness.testcases import FirefoxTestCase
 
 
 class TestWindows(FirefoxTestCase):
--- a/testing/puppeteer/firefox/firefox_puppeteer/__init__.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/__init__.py
@@ -1,13 +1,13 @@
 # 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 os
+# import os
 
 from marionette_driver.marionette import HTMLElement
 
 from decorators import use_class_as_property
 
 
 __version__ = '50.0.0'
 
--- a/testing/puppeteer/firefox/firefox_puppeteer/testcases/__init__.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/testcases/__init__.py
@@ -1,5 +1,5 @@
 # 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 firefox_puppeteer.testcases.base import BaseFirefoxTestCase
+# from firefox_puppeteer.testcases.base import BaseFirefoxTestCase
--- a/testing/puppeteer/firefox/firefox_puppeteer/testcases/base.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/testcases/base.py
@@ -34,26 +34,26 @@ class BaseFirefoxTestCase(unittest.TestC
     def __init__(self, *args, **kwargs):
         super(BaseFirefoxTestCase, self).__init__(*args, **kwargs)
 
     def _check_and_fix_leaked_handles(self):
         handle_count = len(self.marionette.window_handles)
         url = []
 
         try:
-            #Verify the existence of leaked tabs and print their URLs.
+            # Verify the existence of leaked tabs and print their URLs.
             if self._start_handle_count < handle_count:
                 message = ('A test must not leak window handles. This test started with '
                            '%s open top level browsing contexts, but ended with %s.'
-                           ' Remaining Tabs URLs:') % (self._start_handle_count , handle_count)
+                           ' Remaining Tabs URLs:') % (self._start_handle_count, handle_count)
                 with self.marionette.using_context('content'):
                     for tab in self.marionette.window_handles:
                         if tab not in self._init_tab_handles:
                             url.append(' %s' % self.marionette.get_url())
-                self.assertListEqual(self._init_tab_handles , self.marionette.window_handles ,
+                self.assertListEqual(self._init_tab_handles, self.marionette.window_handles,
                                      message + ','.join(url))
         finally:
             # For clean-up make sure we work on a proper browser window
             if not self.browser or self.browser.closed:
                 # Find a proper replacement browser window
                 # TODO: We have to make this less error prone in case no browser is open.
                 self.browser = self.windows.switch_to(lambda win: type(win) is BrowserWindow)
 
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
@@ -1,36 +1,34 @@
 # 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 firefox_puppeteer.errors as errors
+# import firefox_puppeteer.errors as errors
 
 from marionette_driver import By, Wait
-from marionette_driver.errors import (
-    NoSuchElementException,
-    NoSuchWindowException)
-from marionette_driver.keys import Keys
+from marionette_driver.errors import NoSuchElementException
+# from marionette_driver.keys import Keys
 
-from firefox_puppeteer.api.l10n import L10n
-from firefox_puppeteer.api.prefs import Preferences
-from firefox_puppeteer.decorators import use_class_as_property
+# from firefox_puppeteer.api.l10n import L10n
+# from firefox_puppeteer.api.prefs import Preferences
+# from firefox_puppeteer.decorators import use_class_as_property
 from firefox_puppeteer.ui.about_window.window import AboutWindow
 from firefox_puppeteer.ui.browser.notifications import (
     AddOnInstallBlockedNotification,
     AddOnInstallConfirmationNotification,
     AddOnInstallCompleteNotification,
     AddOnInstallFailedNotification,
     AddOnProgressNotification,
     BaseNotification)
 from firefox_puppeteer.ui.browser.tabbar import TabBar
 from firefox_puppeteer.ui.browser.toolbars import NavBar
 from firefox_puppeteer.ui.pageinfo.window import PageInfoWindow
 from firefox_puppeteer.ui.windows import BaseWindow, Windows
-import firefox_puppeteer.errors as errors
+# import firefox_puppeteer.errors as errors
 
 
 class BrowserWindow(BaseWindow):
     """Representation of a browser window."""
 
     window_type = 'navigator:browser'
 
     dtds = [
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/__init__.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/update_wizard/__init__.py
@@ -1,5 +1,5 @@
 # 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 dialog import UpdateWizardDialog
+# from dialog import UpdateWizardDialog