Fix F401 (unused import) throughout tools/ (#11439)
diff --git a/tools/__init__.py b/tools/__init__.py
index 07b5e60..8110d59 100644
--- a/tools/__init__.py
+++ b/tools/__init__.py
@@ -1 +1 @@
-from . import localpaths as _localpaths
+from . import localpaths as _localpaths # noqa: F401
diff --git a/tools/ci/check_stability.py b/tools/ci/check_stability.py
index 1c36153..11716cd 100644
--- a/tools/ci/check_stability.py
+++ b/tools/ci/check_stability.py
@@ -17,7 +17,7 @@
from tools.wpt.utils import Kwargs
from tools.wpt.run import create_parser, setup_wptrunner
from tools.wpt import markdown
-from tools import localpaths
+from tools import localpaths # noqa: F401
logger = None
run_step, write_inconsistent, write_results = None, None, None
diff --git a/tools/ci/jobs.py b/tools/ci/jobs.py
index b58ab92..40d2fef 100644
--- a/tools/ci/jobs.py
+++ b/tools/ci/jobs.py
@@ -1,9 +1,9 @@
import argparse
import os
import re
-from ..wpt.testfiles import branch_point, files_changed, affected_testfiles
+from ..wpt.testfiles import branch_point, files_changed
-from tools import localpaths
+from tools import localpaths # noqa: F401
from six import iteritems
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
diff --git a/tools/gitignore/gitignore.py b/tools/gitignore/gitignore.py
index 0be6f8f..8702cec 100644
--- a/tools/gitignore/gitignore.py
+++ b/tools/gitignore/gitignore.py
@@ -1,4 +1,3 @@
-import itertools
import re
import os
diff --git a/tools/lint/__init__.py b/tools/lint/__init__.py
index e5eb5e1..f3d12ed 100644
--- a/tools/lint/__init__.py
+++ b/tools/lint/__init__.py
@@ -1 +1 @@
-from . import lint
+from . import lint # noqa: F401
diff --git a/tools/lint/lint.py b/tools/lint/lint.py
index 7fd1d1e..3f43b37 100644
--- a/tools/lint/lint.py
+++ b/tools/lint/lint.py
@@ -3,7 +3,6 @@
import abc
import argparse
import ast
-import itertools
import json
import os
import re
diff --git a/tools/lint/tests/test_lint.py b/tools/lint/tests/test_lint.py
index c593c84..1fc0c7a 100644
--- a/tools/lint/tests/test_lint.py
+++ b/tools/lint/tests/test_lint.py
@@ -4,7 +4,6 @@
import sys
import mock
-import pytest
import six
from ...localpaths import repo_root
diff --git a/tools/lint/tests/test_path_lints.py b/tools/lint/tests/test_path_lints.py
index b581828..bf8418d 100644
--- a/tools/lint/tests/test_path_lints.py
+++ b/tools/lint/tests/test_path_lints.py
@@ -3,7 +3,6 @@
from ..lint import check_path
from .base import check_errors
import pytest
-import six
def test_allowed_path_length():
basename = 29 * "test/"
diff --git a/tools/manifest/__init__.py b/tools/manifest/__init__.py
index 72b7ee5..8c8f189 100644
--- a/tools/manifest/__init__.py
+++ b/tools/manifest/__init__.py
@@ -1,4 +1 @@
-from . import item
-from . import manifest
-from . import sourcefile
-from . import update
+from . import item, manifest, sourcefile, update # noqa: F401
diff --git a/tools/manifest/item.py b/tools/manifest/item.py
index 5a87d28..98abeba 100644
--- a/tools/manifest/item.py
+++ b/tools/manifest/item.py
@@ -1,6 +1,5 @@
-import os
from six.moves.urllib.parse import urljoin
-from abc import ABCMeta, abstractmethod, abstractproperty
+from abc import ABCMeta, abstractproperty
def get_source_file(source_files, tests_root, manifest, path):
diff --git a/tools/manifest/manifest.py b/tools/manifest/manifest.py
index df8ee94..02250e8 100644
--- a/tools/manifest/manifest.py
+++ b/tools/manifest/manifest.py
@@ -6,7 +6,7 @@
from .item import ManualTest, WebdriverSpecTest, Stub, RefTestNode, RefTest, TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest
from .log import get_logger
-from .utils import from_os_path, to_os_path, rel_path_to_url
+from .utils import from_os_path, to_os_path
CURRENT_VERSION = 4
diff --git a/tools/manifest/sourcefile.py b/tools/manifest/sourcefile.py
index c4d8e5e..a303b2c 100644
--- a/tools/manifest/sourcefile.py
+++ b/tools/manifest/sourcefile.py
@@ -12,7 +12,7 @@
import html5lib
from . import XMLParser
-from .item import Stub, ManualTest, WebdriverSpecTest, RefTestNode, RefTest, TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest
+from .item import Stub, ManualTest, WebdriverSpecTest, RefTestNode, TestharnessTest, SupportFile, ConformanceCheckerTest, VisualTest
from .utils import rel_path_to_url, ContextManagerBytesIO, cached_property
wd_pattern = "*.py"
diff --git a/tools/manifest/tests/test_manifest.py b/tools/manifest/tests/test_manifest.py
index 67e82b5..04e8f1e 100644
--- a/tools/manifest/tests/test_manifest.py
+++ b/tools/manifest/tests/test_manifest.py
@@ -1,4 +1,3 @@
-import platform
import os
import mock
@@ -8,7 +7,7 @@
import pytest
-from .. import manifest, item, sourcefile, utils
+from .. import manifest, item, utils
def SourceFileWithTest(path, hash, cls, *args):
diff --git a/tools/manifest/update.py b/tools/manifest/update.py
index 29c8010..9923cc5 100644
--- a/tools/manifest/update.py
+++ b/tools/manifest/update.py
@@ -1,8 +1,6 @@
#!/usr/bin/env python
import argparse
-import imp
import os
-import sys
import manifest
from . import vcs
diff --git a/tools/runner/update_manifest.py b/tools/runner/update_manifest.py
index 0b2c8a2..714d2b5 100644
--- a/tools/runner/update_manifest.py
+++ b/tools/runner/update_manifest.py
@@ -1,7 +1,6 @@
import imp
import json
import os
-import sys
here = os.path.dirname(__file__)
localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, "localpaths.py")))
diff --git a/tools/serve/__init__.py b/tools/serve/__init__.py
index fc2f2f0..948482f 100644
--- a/tools/serve/__init__.py
+++ b/tools/serve/__init__.py
@@ -1 +1 @@
-import serve
+import serve # noqa: F401
diff --git a/tools/tox.ini b/tools/tox.ini
index cd97745..24fe742 100644
--- a/tools/tox.ini
+++ b/tools/tox.ini
@@ -39,9 +39,8 @@
# E731: do not assign a lambda expression, use a def
# E901: SyntaxError or IndentationError
# W601: .has_key() is deprecated, use ‘in’
-# F401: module imported but unused
# N801: class names should use CapWords convention
# N802: function name should be lowercase
-ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,F401,N801,N802
+ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
max-line-length = 141
exclude = .tox,html5lib,third_party/py,third_party/pytest,third_party/funcsigs,third_party/attrs,third_party/pluggy/,pywebsocket,six,_venv,webencodings,wptserve/docs,wptserve/tests/functional/docroot/,wpt,wptrunner
diff --git a/tools/webdriver/webdriver/__init__.py b/tools/webdriver/webdriver/__init__.py
index 30243f7..9e988d3 100644
--- a/tools/webdriver/webdriver/__init__.py
+++ b/tools/webdriver/webdriver/__init__.py
@@ -1,3 +1,4 @@
+# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
from client import Cookies, Element, Find, Session, Timeouts, Window
from error import (
ElementNotSelectableException,
diff --git a/tools/wpt/browser.py b/tools/wpt/browser.py
index de9f929..c350946 100644
--- a/tools/wpt/browser.py
+++ b/tools/wpt/browser.py
@@ -5,13 +5,10 @@
import shutil
import stat
import subprocess
-import sys
import tempfile
from abc import ABCMeta, abstractmethod
-from ConfigParser import RawConfigParser
from datetime import datetime, timedelta
from distutils.spawn import find_executable
-from io import BytesIO
from utils import call, get, untar, unzip
diff --git a/tools/wpt/run.py b/tools/wpt/run.py
index 26e0172..b51407f 100644
--- a/tools/wpt/run.py
+++ b/tools/wpt/run.py
@@ -1,10 +1,7 @@
import argparse
import os
import platform
-import shutil
-import subprocess
import sys
-import tarfile
from distutils.spawn import find_executable
wpt_root = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
@@ -466,7 +463,7 @@
if __name__ == "__main__":
import pdb
- from tools import localpaths
+ from tools import localpaths # noqa: flake8
try:
main()
except Exception:
diff --git a/tools/wpt/testfiles.py b/tools/wpt/testfiles.py
index d7779fe..47431b5 100644
--- a/tools/wpt/testfiles.py
+++ b/tools/wpt/testfiles.py
@@ -1,5 +1,4 @@
import argparse
-import itertools
import logging
import os
import re
diff --git a/tools/wpt/tox.ini b/tools/wpt/tox.ini
index 86a025f..31ded48 100644
--- a/tools/wpt/tox.ini
+++ b/tools/wpt/tox.ini
@@ -42,8 +42,7 @@
# E731: do not assign a lambda expression, use a def
# E901: SyntaxError or IndentationError
# W601: .has_key() is deprecated, use ‘in’
-# F401: module imported but unused
# N801: class names should use CapWords convention
# N802: function name should be lowercase
-ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,F401,N801,N802
+ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
max-line-length = 141
diff --git a/tools/wpt/wpt.py b/tools/wpt/wpt.py
index 882d5ab..f4eecce 100644
--- a/tools/wpt/wpt.py
+++ b/tools/wpt/wpt.py
@@ -4,7 +4,7 @@
import os
import sys
-from tools import localpaths
+from tools import localpaths # noqa: flake8
from six import iteritems
from . import virtualenv
diff --git a/tools/wptrunner/docs/conf.py b/tools/wptrunner/docs/conf.py
index b58f313..c2d4fd5 100644
--- a/tools/wptrunner/docs/conf.py
+++ b/tools/wptrunner/docs/conf.py
@@ -12,8 +12,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys
-import os
+#import sys
+#import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
diff --git a/tools/wptrunner/test/test.py b/tools/wptrunner/test/test.py
index 3e82a98..9960dcd 100644
--- a/tools/wptrunner/test/test.py
+++ b/tools/wptrunner/test/test.py
@@ -1,15 +1,10 @@
import ConfigParser
import argparse
-import json
import os
import sys
-import tempfile
-import threading
-import time
-from StringIO import StringIO
-from mozlog import structuredlog, reader
-from mozlog.handlers import BaseHandler, StreamHandler, StatusHandler
+from mozlog import structuredlog
+from mozlog.handlers import BaseHandler, StreamHandler
from mozlog.formatters import MachFormatter
from wptrunner import wptcommandline, wptrunner
diff --git a/tools/wptrunner/tox.ini b/tools/wptrunner/tox.ini
index f939b32..80bf12c 100644
--- a/tools/wptrunner/tox.ini
+++ b/tools/wptrunner/tox.ini
@@ -52,8 +52,7 @@
# E731: do not assign a lambda expression, use a def
# E901: SyntaxError or IndentationError
# W601: .has_key() is deprecated, use ‘in’
-# F401: module imported but unused
# N801: class names should use CapWords convention
# N802: function name should be lowercase
-ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,F401,N801,N802
+ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
max-line-length = 141
diff --git a/tools/wptrunner/wptrunner/browsers/base.py b/tools/wptrunner/wptrunner/browsers/base.py
index e4c9c30..777ee77 100644
--- a/tools/wptrunner/wptrunner/browsers/base.py
+++ b/tools/wptrunner/wptrunner/browsers/base.py
@@ -3,7 +3,7 @@
import socket
from abc import ABCMeta, abstractmethod
-from ..wptcommandline import require_arg
+from ..wptcommandline import require_arg # noqa: F401
here = os.path.split(__file__)[0]
diff --git a/tools/wptrunner/wptrunner/browsers/chrome.py b/tools/wptrunner/wptrunner/browsers/chrome.py
index e50c592..696d5f1 100644
--- a/tools/wptrunner/wptrunner/browsers/chrome.py
+++ b/tools/wptrunner/wptrunner/browsers/chrome.py
@@ -1,9 +1,9 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executorchrome import ChromeDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "chrome",
diff --git a/tools/wptrunner/wptrunner/browsers/chrome_android.py b/tools/wptrunner/wptrunner/browsers/chrome_android.py
index 89179a0..84bc07e 100644
--- a/tools/wptrunner/wptrunner/browsers/chrome_android.py
+++ b/tools/wptrunner/wptrunner/browsers/chrome_android.py
@@ -3,9 +3,9 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executorchrome import ChromeDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "chrome_android",
diff --git a/tools/wptrunner/wptrunner/browsers/edge.py b/tools/wptrunner/wptrunner/browsers/edge.py
index db39a9a..75be31e 100644
--- a/tools/wptrunner/wptrunner/browsers/edge.py
+++ b/tools/wptrunner/wptrunner/browsers/edge.py
@@ -1,9 +1,9 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import EdgeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executoredge import EdgeDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executoredge import EdgeDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "edge",
"check_args": "check_args",
@@ -35,8 +35,6 @@
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
- from selenium.webdriver import DesiredCapabilities
-
executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, **kwargs)
executor_kwargs["close_after_done"] = True
diff --git a/tools/wptrunner/wptrunner/browsers/firefox.py b/tools/wptrunner/wptrunner/browsers/firefox.py
index 309416e..9f57bb4 100644
--- a/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -4,7 +4,6 @@
import signal
import subprocess
import sys
-import tempfile
import mozinfo
import mozleak
@@ -21,9 +20,9 @@
cmd_arg,
browser_command)
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executormarionette import (MarionetteTestharnessExecutor,
- MarionetteRefTestExecutor,
- MarionetteWdspecExecutor)
+from ..executors.executormarionette import (MarionetteTestharnessExecutor, # noqa: F401
+ MarionetteRefTestExecutor, # noqa: F401
+ MarionetteWdspecExecutor) # noqa: F401
here = os.path.join(os.path.split(__file__)[0])
diff --git a/tools/wptrunner/wptrunner/browsers/ie.py b/tools/wptrunner/wptrunner/browsers/ie.py
index 97d96ec..1b9ce01 100644
--- a/tools/wptrunner/wptrunner/browsers/ie.py
+++ b/tools/wptrunner/wptrunner/browsers/ie.py
@@ -1,9 +1,9 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import InternetExplorerDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executorinternetexplorer import InternetExplorerDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executorinternetexplorer import InternetExplorerDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "ie",
"check_args": "check_args",
@@ -26,8 +26,6 @@
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
- from selenium.webdriver import DesiredCapabilities
-
options = {}
options["requireWindowFocus"] = True
capabilities = {}
diff --git a/tools/wptrunner/wptrunner/browsers/opera.py b/tools/wptrunner/wptrunner/browsers/opera.py
index bfacfa5..1775191 100644
--- a/tools/wptrunner/wptrunner/browsers/opera.py
+++ b/tools/wptrunner/wptrunner/browsers/opera.py
@@ -1,9 +1,9 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import OperaDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executoropera import OperaDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executoropera import OperaDriverWdspecExecutor # noqa: F401
__wptrunner__ = {"product": "opera",
diff --git a/tools/wptrunner/wptrunner/browsers/safari.py b/tools/wptrunner/wptrunner/browsers/safari.py
index 3b99d22..bbf9b01 100644
--- a/tools/wptrunner/wptrunner/browsers/safari.py
+++ b/tools/wptrunner/wptrunner/browsers/safari.py
@@ -1,8 +1,8 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import SafariDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
__wptrunner__ = {"product": "safari",
diff --git a/tools/wptrunner/wptrunner/browsers/sauce.py b/tools/wptrunner/wptrunner/browsers/sauce.py
index 74eb1fe..ae67baa 100644
--- a/tools/wptrunner/wptrunner/browsers/sauce.py
+++ b/tools/wptrunner/wptrunner/browsers/sauce.py
@@ -15,8 +15,8 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
here = os.path.split(__file__)[0]
# Number of seconds to wait between polling operations when detecting status of
diff --git a/tools/wptrunner/wptrunner/browsers/servo.py b/tools/wptrunner/wptrunner/browsers/servo.py
index dd54fb0..ae717b8 100644
--- a/tools/wptrunner/wptrunner/browsers/servo.py
+++ b/tools/wptrunner/wptrunner/browsers/servo.py
@@ -2,7 +2,7 @@
from .base import NullBrowser, ExecutorBrowser, require_arg
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorservo import ServoTestharnessExecutor, ServoRefTestExecutor, ServoWdspecExecutor
+from ..executors.executorservo import ServoTestharnessExecutor, ServoRefTestExecutor, ServoWdspecExecutor # noqa: F401
here = os.path.join(os.path.split(__file__)[0])
diff --git a/tools/wptrunner/wptrunner/browsers/servodriver.py b/tools/wptrunner/wptrunner/browsers/servodriver.py
index f2ee00a..ad0bcbd 100644
--- a/tools/wptrunner/wptrunner/browsers/servodriver.py
+++ b/tools/wptrunner/wptrunner/browsers/servodriver.py
@@ -9,8 +9,8 @@
from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor,
- ServoWebDriverRefTestExecutor)
+from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor, # noqa: F401
+ ServoWebDriverRefTestExecutor) # noqa: F401
here = os.path.join(os.path.split(__file__)[0])
diff --git a/tools/wptrunner/wptrunner/browsers/webkit.py b/tools/wptrunner/wptrunner/browsers/webkit.py
index 7d95d43..1c8aec9 100644
--- a/tools/wptrunner/wptrunner/browsers/webkit.py
+++ b/tools/wptrunner/wptrunner/browsers/webkit.py
@@ -1,8 +1,8 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..executors import executor_kwargs as base_executor_kwargs
-from ..executors.executorselenium import (SeleniumTestharnessExecutor,
- SeleniumRefTestExecutor)
-from ..executors.executorwebkit import WebKitDriverWdspecExecutor
+from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
+ SeleniumRefTestExecutor) # noqa: F401
+from ..executors.executorwebkit import WebKitDriverWdspecExecutor # noqa: F401
from ..webdriver_server import WebKitDriverServer
diff --git a/tools/wptrunner/wptrunner/executors/__init__.py b/tools/wptrunner/wptrunner/executors/__init__.py
index 24761b8..a580730 100644
--- a/tools/wptrunner/wptrunner/executors/__init__.py
+++ b/tools/wptrunner/wptrunner/executors/__init__.py
@@ -1,3 +1,4 @@
+# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
from base import (executor_kwargs,
testharness_result_converter,
reftest_result_converter,
diff --git a/tools/wptrunner/wptrunner/executors/executormarionette.py b/tools/wptrunner/wptrunner/executors/executormarionette.py
index f04f0b5..71442e6 100644
--- a/tools/wptrunner/wptrunner/executors/executormarionette.py
+++ b/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -13,17 +13,12 @@
here = os.path.join(os.path.split(__file__)[0])
from .base import (CallbackHandler,
- ExecutorException,
RefTestExecutor,
RefTestImplementation,
- TestExecutor,
TestharnessExecutor,
WdspecExecutor,
- WdspecRun,
WebDriverProtocol,
extra_timeout,
- testharness_result_converter,
- reftest_result_converter,
strip_server)
from .protocol import (BaseProtocolPart,
TestharnessProtocolPart,
diff --git a/tools/wptrunner/wptrunner/executors/executorselenium.py b/tools/wptrunner/wptrunner/executors/executorselenium.py
index 98c49bd..d9b6796 100644
--- a/tools/wptrunner/wptrunner/executors/executorselenium.py
+++ b/tools/wptrunner/wptrunner/executors/executorselenium.py
@@ -1,9 +1,7 @@
import json
import os
import socket
-import sys
import threading
-import time
import traceback
import urlparse
import uuid
diff --git a/tools/wptrunner/wptrunner/executors/executorservo.py b/tools/wptrunner/wptrunner/executors/executorservo.py
index fb79cf2..caa9714 100644
--- a/tools/wptrunner/wptrunner/executors/executorservo.py
+++ b/tools/wptrunner/wptrunner/executors/executorservo.py
@@ -1,22 +1,16 @@
import base64
-import hashlib
-import httplib
import json
import os
import subprocess
import tempfile
import threading
-import traceback
-import urlparse
import uuid
-from collections import defaultdict
from mozprocess import ProcessHandler
from serve.serve import make_hosts_file
-from .base import (ExecutorException,
- ConnectionlessProtocol,
+from .base import (ConnectionlessProtocol,
RefTestImplementation,
testharness_result_converter,
reftest_result_converter,
@@ -24,9 +18,7 @@
WebDriverProtocol)
from .process import ProcessTestExecutor
from ..browsers.base import browser_command
-from ..wpttest import WdspecResult, WdspecSubtestResult
from ..webdriver_server import ServoDriverServer
-from .executormarionette import WdspecRun
pytestrunner = None
webdriver = None
diff --git a/tools/wptrunner/wptrunner/executors/pytestrunner/__init__.py b/tools/wptrunner/wptrunner/executors/pytestrunner/__init__.py
index a92b3a8..1baaf95 100644
--- a/tools/wptrunner/wptrunner/executors/pytestrunner/__init__.py
+++ b/tools/wptrunner/wptrunner/executors/pytestrunner/__init__.py
@@ -1 +1 @@
-from .runner import run
+from .runner import run # noqa: F401
diff --git a/tools/wptrunner/wptrunner/metadata.py b/tools/wptrunner/wptrunner/metadata.py
index 195671c..2527df8 100644
--- a/tools/wptrunner/wptrunner/metadata.py
+++ b/tools/wptrunner/wptrunner/metadata.py
@@ -1,10 +1,7 @@
import os
import shutil
-import sys
import tempfile
-import types
import uuid
-from collections import defaultdict
from mozlog import reader
from mozlog import structuredlog
diff --git a/tools/wptrunner/wptrunner/products.py b/tools/wptrunner/wptrunner/products.py
index 4f22737..0c1f86f 100644
--- a/tools/wptrunner/wptrunner/products.py
+++ b/tools/wptrunner/wptrunner/products.py
@@ -1,4 +1,3 @@
-import os
import importlib
import imp
diff --git a/tools/wptrunner/wptrunner/testrunner.py b/tools/wptrunner/wptrunner/testrunner.py
index 257e789..73a106b 100644
--- a/tools/wptrunner/wptrunner/testrunner.py
+++ b/tools/wptrunner/wptrunner/testrunner.py
@@ -1,7 +1,6 @@
from __future__ import unicode_literals
import multiprocessing
-import sys
import threading
import traceback
from Queue import Empty
diff --git a/tools/wptrunner/wptrunner/tests/test_chunker.py b/tools/wptrunner/wptrunner/tests/test_chunker.py
index 062b687..b70d546 100644
--- a/tools/wptrunner/wptrunner/tests/test_chunker.py
+++ b/tools/wptrunner/wptrunner/tests/test_chunker.py
@@ -3,8 +3,6 @@
from os.path import join, dirname
from mozlog import structured
-import pytest
-
sys.path.insert(0, join(dirname(__file__), "..", ".."))
from wptrunner.testloader import EqualTimeChunker
diff --git a/tools/wptrunner/wptrunner/tests/test_products.py b/tools/wptrunner/wptrunner/tests/test_products.py
index f5d490d..5392423 100644
--- a/tools/wptrunner/wptrunner/tests/test_products.py
+++ b/tools/wptrunner/wptrunner/tests/test_products.py
@@ -1,4 +1,3 @@
-import os
import sys
from os.path import join, dirname
@@ -9,7 +8,7 @@
from .base import all_products, active_products
sys.path.insert(0, join(dirname(__file__), "..", "..", "..", "..")) # repo root
-from tools import localpaths
+from tools import localpaths # noqa: flake8
from wptserve import sslutils
from wptrunner import environment
diff --git a/tools/wptrunner/wptrunner/update/__init__.py b/tools/wptrunner/wptrunner/update/__init__.py
index 99dac6b..9ff3e69 100644
--- a/tools/wptrunner/wptrunner/update/__init__.py
+++ b/tools/wptrunner/wptrunner/update/__init__.py
@@ -1,4 +1,3 @@
-import os
import sys
from mozlog.structured import structuredlog, commandline
diff --git a/tools/wptrunner/wptrunner/update/sync.py b/tools/wptrunner/wptrunner/update/sync.py
index f2660e5..3c4df31 100644
--- a/tools/wptrunner/wptrunner/update/sync.py
+++ b/tools/wptrunner/wptrunner/update/sync.py
@@ -5,8 +5,6 @@
import sys
import uuid
-from .. import testloader
-
from base import Step, StepRunner
from tree import Commit
diff --git a/tools/wptrunner/wptrunner/update/tree.py b/tools/wptrunner/wptrunner/update/tree.py
index 2e35236..69cae7b 100644
--- a/tools/wptrunner/wptrunner/update/tree.py
+++ b/tools/wptrunner/wptrunner/update/tree.py
@@ -3,7 +3,7 @@
import subprocess
from .. import vcs
-from ..vcs import bind_to_repo, git, hg
+from ..vcs import git, hg
def get_unique_name(existing, initial):
diff --git a/tools/wptrunner/wptrunner/update/update.py b/tools/wptrunner/wptrunner/update/update.py
index a047f76..5685f84 100644
--- a/tools/wptrunner/wptrunner/update/update.py
+++ b/tools/wptrunner/wptrunner/update/update.py
@@ -10,7 +10,7 @@
def setup_paths(sync_path):
sys.path.insert(0, os.path.abspath(sync_path))
- from tools import localpaths
+ from tools import localpaths # noqa: flake8
class LoadConfig(Step):
"""Step for loading configuration from the ini file and kwargs."""
diff --git a/tools/wptrunner/wptrunner/webdriver_server.py b/tools/wptrunner/wptrunner/webdriver_server.py
index 5822b36..9ecd009 100644
--- a/tools/wptrunner/wptrunner/webdriver_server.py
+++ b/tools/wptrunner/wptrunner/webdriver_server.py
@@ -3,10 +3,8 @@
import os
import platform
import socket
-import threading
import time
import traceback
-import urlparse
import mozprocess
diff --git a/tools/wptrunner/wptrunner/wptcommandline.py b/tools/wptrunner/wptrunner/wptcommandline.py
index 334df2f..d260245 100644
--- a/tools/wptrunner/wptrunner/wptcommandline.py
+++ b/tools/wptrunner/wptrunner/wptcommandline.py
@@ -1,10 +1,9 @@
import argparse
-import ast
import os
import sys
from collections import OrderedDict
from distutils.spawn import find_executable
-from datetime import datetime, timedelta
+from datetime import timedelta
import config
import wpttest
diff --git a/tools/wptrunner/wptrunner/wptlogging.py b/tools/wptrunner/wptrunner/wptlogging.py
index 26d174c..ac31181 100644
--- a/tools/wptrunner/wptrunner/wptlogging.py
+++ b/tools/wptrunner/wptrunner/wptlogging.py
@@ -1,7 +1,6 @@
import logging
import sys
import threading
-from Queue import Empty
from StringIO import StringIO
from multiprocessing import Queue
diff --git a/tools/wptrunner/wptrunner/wptmanifest/__init__.py b/tools/wptrunner/wptrunner/wptmanifest/__init__.py
index 6b64784..8985b5a 100644
--- a/tools/wptrunner/wptrunner/wptmanifest/__init__.py
+++ b/tools/wptrunner/wptrunner/wptmanifest/__init__.py
@@ -1,3 +1,4 @@
+# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
from serializer import serialize
from parser import parse
from backends.static import compile as compile_static
diff --git a/tools/wptrunner/wptrunner/wptmanifest/parser.py b/tools/wptrunner/wptrunner/wptmanifest/parser.py
index 1fa1bc1..9763670 100644
--- a/tools/wptrunner/wptrunner/wptmanifest/parser.py
+++ b/tools/wptrunner/wptrunner/wptmanifest/parser.py
@@ -14,7 +14,6 @@
from __future__ import unicode_literals
-import types
from cStringIO import StringIO
from node import (AtomNode, BinaryExpressionNode, BinaryOperatorNode,
diff --git a/tools/wptrunner/wptrunner/wptmanifest/tests/test_conditional.py b/tools/wptrunner/wptrunner/wptmanifest/tests/test_conditional.py
index d9ffdf2..9da1a0f 100644
--- a/tools/wptrunner/wptrunner/wptmanifest/tests/test_conditional.py
+++ b/tools/wptrunner/wptrunner/wptmanifest/tests/test_conditional.py
@@ -1,7 +1,5 @@
import unittest
-from cStringIO import StringIO
-
from ..backends import conditional
from ..node import BinaryExpressionNode, BinaryOperatorNode, VariableNode, NumberNode
diff --git a/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py b/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py
index 6908ea4..91a87a9 100644
--- a/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py
+++ b/tools/wptrunner/wptrunner/wptmanifest/tests/test_serializer.py
@@ -1,8 +1,6 @@
import sys
import unittest
-from cStringIO import StringIO
-
import pytest
from .. import parser, serializer
diff --git a/tools/wptrunner/wptrunner/wptmanifest/tests/test_static.py b/tools/wptrunner/wptrunner/wptmanifest/tests/test_static.py
index ed28578..f638696 100644
--- a/tools/wptrunner/wptrunner/wptmanifest/tests/test_static.py
+++ b/tools/wptrunner/wptrunner/wptmanifest/tests/test_static.py
@@ -1,7 +1,5 @@
import unittest
-from cStringIO import StringIO
-
from ..backends import static
# There aren't many tests here because it turns out to be way more convenient to
diff --git a/tools/wptserve/tests/functional/test_request.py b/tools/wptserve/tests/functional/test_request.py
index b2ef0e2..24eedbc 100644
--- a/tools/wptserve/tests/functional/test_request.py
+++ b/tools/wptserve/tests/functional/test_request.py
@@ -1,11 +1,8 @@
-import unittest
-
import pytest
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer
from wptserve.request import InputFile
-from urllib2 import HTTPError
class TestInputFile(TestUsingServer):
diff --git a/tools/wptserve/wptserve/sslutils/__init__.py b/tools/wptserve/wptserve/sslutils/__init__.py
index e46be85..0c0ea43 100644
--- a/tools/wptserve/wptserve/sslutils/__init__.py
+++ b/tools/wptserve/wptserve/sslutils/__init__.py
@@ -1,3 +1,4 @@
+# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
import openssl
import pregenerated
from base import NoSSLEnvironment