Bug 1406666 - Add testing/*cppun*.py to the list of flake8 compliant code r=ahal
authorSylvestre Ledru <sledru@mozilla.com>
Sat, 07 Oct 2017 19:45:12 +0200
changeset 385665 9267711b1ddfef1a88f518983933ba3a6779e6bf
parent 385664 370a4a2a78980dea15b6a3f0801f902a62602741
child 385666 0648d35fc2d89d4aeb1352fcfb41e51db1b4a434
push id32664
push userarchaeopteryx@coole-files.de
push dateThu, 12 Oct 2017 09:34:55 +0000
treeherdermozilla-central@a32c32d9631c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1406666
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1406666 - Add testing/*cppun*.py to the list of flake8 compliant code r=ahal MozReview-Commit-ID: KWsXMRgy4XG
testing/remotecppunittests.py
testing/runcppunittests.py
tools/lint/flake8.yml
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -175,17 +175,18 @@ class RemoteCPPUnittestOptions(cppunitte
 
         self.add_option("--devicePort", action="store",
                         type="string", dest="device_port",
                         help="port of remote device to test")
         defaults["device_port"] = 20701
 
         self.add_option("--noSetup", action="store_false",
                         dest="setup",
-                        help="do not copy any files to device (to be used only if device is already setup)")
+                        help="do not copy any files to device (to be used only if "
+                        "device is already setup)")
         defaults["setup"] = True
 
         self.add_option("--localLib", action="store",
                         type="string", dest="local_lib",
                         help="location of libraries to push -- preferably stripped")
         defaults["local_lib"] = None
 
         self.add_option("--apk", action="store",
@@ -208,17 +209,18 @@ class RemoteCPPUnittestOptions(cppunitte
 
         self.add_option("--with-b2g-emulator", action="store",
                         type="string", dest="with_b2g_emulator",
                         help="Start B2G Emulator (specify path to b2g home)")
         self.add_option("--emulator", default="arm", choices=["x86", "arm"],
                         help="Architecture of emulator to use: x86 or arm")
         self.add_option("--addEnv", action="append",
                         type="string", dest="add_env",
-                        help="additional remote environment variable definitions (eg. --addEnv \"somevar=something\")")
+                        help="additional remote environment variable definitions "
+                        "(eg. --addEnv \"somevar=something\")")
         defaults["add_env"] = None
 
         self.set_defaults(**defaults)
 
 
 def run_test_harness(options, args):
     if options.with_b2g_emulator:
         from mozrunner import B2GEmulatorRunner
@@ -232,17 +234,17 @@ def run_test_harness(options, args):
         retryLimit = 5
     try:
         dm_args = {'deviceRoot': options.remote_test_root}
         dm_args['retryLimit'] = retryLimit
         if options.device_ip:
             dm_args['host'] = options.device_ip
             dm_args['port'] = options.device_port
         if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
-            dm_args['logLevel'] = logging.DEBUG
+            dm_args['logLevel'] = logging.DEBUG # noqa python 2 / 3
         dm = devicemanagerADB.DeviceManagerADB(**dm_args)
     except:
         if options.with_b2g_emulator:
             runner.cleanup()
             runner.wait()
         raise
 
     options.xre_path = os.path.abspath(options.xre_path)
--- a/testing/runcppunittests.py
+++ b/testing/runcppunittests.py
@@ -90,17 +90,18 @@ class CPPUnitTests(object):
         env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
         env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
         env["MOZ_CRASHREPORTER"] = "1"
         return env
 
     def build_environment(self):
         """
         Create and return a dictionary of all the appropriate env variables and values.
-        On a remote system, we overload this to set different values and are missing things like os.environ and PATH.
+        On a remote system, we overload this to set different values and are missing things
+        like os.environ and PATH.
         """
         if not os.path.isdir(self.xre_path):
             raise Exception("xre_path does not exist: %s", self.xre_path)
         env = dict(os.environ)
         env = self.build_core_environment(env)
         pathvar = ""
         libpath = self.xre_path
         if mozinfo.os == "linux":
@@ -180,17 +181,18 @@ class CPPUnittestOptions(OptionParser):
         OptionParser.__init__(self)
         self.add_option("--xre-path",
                         action="store", type="string", dest="xre_path",
                         default=None,
                         help="absolute path to directory containing XRE (probably xulrunner)")
         self.add_option("--symbols-path",
                         action="store", type="string", dest="symbols_path",
                         default=None,
-                        help="absolute path to directory containing breakpad symbols, or the URL of a zip file containing symbols")
+                        help="absolute path to directory containing breakpad symbols, or "
+                        "the URL of a zip file containing symbols")
         self.add_option("--manifest-path",
                         action="store", type="string", dest="manifest_path",
                         default=None,
                         help="path to test manifest, if different from the path to test binaries")
 
 
 def extract_unittests_from_args(args, environ, manifest_path):
     """Extract unittests from args, expanding directories as needed"""
@@ -213,19 +215,26 @@ def extract_unittests_from_args(args, en
             else:
                 tests.append((os.path.abspath(p), 1))
 
     # we skip the existence check here because not all tests are built
     # for all platforms (and it will fail on Windows anyway)
     active_tests = mp.active_tests(exists=False, disabled=False, **environ)
     suffix = '.exe' if mozinfo.isWin else ''
     if binary_path:
-        tests.extend([(os.path.join(binary_path, test['relpath'] + suffix), int(test.get('requesttimeoutfactor', 1))) for test in active_tests])
+        tests.extend([
+            (os.path.join(binary_path, test['relpath'] + suffix),
+             int(test.get('requesttimeoutfactor', 1)))
+            for test in active_tests])
     else:
-        tests.extend([(test['path'] + suffix, int(test.get('requesttimeoutfactor', 1))) for test in active_tests])
+        tests.extend([
+            (test['path'] + suffix,
+             int(test.get('requesttimeoutfactor', 1)))
+            for test in active_tests
+        ])
 
     # skip non-existing tests
     tests = [test for test in tests if os.path.isfile(test[0])]
 
     return tests
 
 
 def update_mozinfo():
--- a/tools/lint/flake8.yml
+++ b/tools/lint/flake8.yml
@@ -12,16 +12,18 @@ flake8:
         - taskcluster
         - testing/firefox-ui
         - testing/mach_commands.py
         - testing/marionette/client
         - testing/marionette/harness
         - testing/marionette/puppeteer
         - testing/mozbase
         - testing/mochitest
+        - testing/remotecppunittests.py
+        - testing/runcppunittests.py
         - testing/talos/
         - testing/xpcshell
         - tools/git
         - tools/lint
         - tools/mercurial
         - tools/tryselect
         - toolkit/components/telemetry
     # Excludes should be added to topsrcdir/.flake8 due to a bug in flake8 where