Revert "[CodeHealth] Migrate remainder of testing/ to Python3 compatible syntax"

This reverts commit 8defc6c6da91e4b7d7a686b7bb67658d9a5ebe55.

Reason for revert: Makes win-chrome fail:
https://ci.chromium.org/p/chrome/builders/try/win-chrome/4538

Original change's description:
> [CodeHealth] Migrate remainder of testing/ to Python3 compatible syntax
>
> and Pylint2.7, and fix resulting errors.
>
> Bug: 1262363
> Change-Id: I09628427dd4caf9d873f3b489b897054430f8567
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3557490
> Reviewed-by: Ben Pastene <[email protected]>
> Commit-Queue: Joshua Hood <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#996200}

Bug: 1262363
Change-Id: I74384a8cbd77e0db5adbbd5815d54e836472b756
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3607233
Auto-Submit: Sebastien Lalancette <[email protected]>
Reviewed-by: Ben Pastene <[email protected]>
Commit-Queue: Ben Pastene <[email protected]>
Cr-Commit-Position: refs/heads/main@{#996362}
diff --git a/testing/PRESUBMIT.py b/testing/PRESUBMIT.py
index 6a5524c..61b4fc1 100644
--- a/testing/PRESUBMIT.py
+++ b/testing/PRESUBMIT.py
@@ -23,9 +23,7 @@
       input_api,
       output_api,
       '.',
-      [r'^.+_unittest\.py$'],
-      run_on_python3=USE_PYTHON3,
-      skip_shebang_check=True))
+      [r'^.+_unittest\.py$']))
   output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
       input_api,
       output_api,
@@ -38,6 +36,21 @@
   output.extend(input_api.canned_checks.RunPylint(
       input_api,
       output_api,
+      files_to_skip=[r'gmock.*', r'gtest.*',
+          r'buildbot.*', r'merge_scripts.*', r'trigger_scripts.*',
+          r'unexpected_passes_common.*',
+          r'clusterfuzz.*',
+          r'libfuzzer.*']))
+  # Pylint2.7 is run on subdirs whose presubmit checks are migrated to Python3
+  output.extend(input_api.canned_checks.RunPylint(
+      input_api,
+      output_api,
+      files_to_check=[r'buildbot.*\.py$',
+          r'merge_scripts.*\.py$',
+          r'trigger_scripts.*\.py$',
+          r'unexpected_passes_common.*\.py$',
+          r'clusterfuzz.*\.py$',
+          r'libfuzzer.*\.py$'],
       version='2.7'))
 
   return output
diff --git a/testing/__init__.py b/testing/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/testing/__init__.py
+++ /dev/null
diff --git a/testing/buildbot/PRESUBMIT_test.py b/testing/buildbot/PRESUBMIT_test.py
index 38e97fc..0ef25a4 100755
--- a/testing/buildbot/PRESUBMIT_test.py
+++ b/testing/buildbot/PRESUBMIT_test.py
@@ -3,14 +3,10 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import os
-import sys
 import time
 import unittest
 
-# Add src/testing/ into sys.path for importing PRESUBMIT without pylint errors.
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
-from buildbot import PRESUBMIT
+import PRESUBMIT
 
 
 class PresubmitError:
diff --git a/testing/buildbot/__init__.py b/testing/buildbot/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/testing/buildbot/__init__.py
+++ /dev/null
diff --git a/testing/chromoting/browser_tests_launcher.py b/testing/chromoting/browser_tests_launcher.py
index c0dd849..6f0ba62 100644
--- a/testing/chromoting/browser_tests_launcher.py
+++ b/testing/chromoting/browser_tests_launcher.py
@@ -85,7 +85,7 @@
       retries += 1
       time.sleep(30)
       continue
-    if jids_used:
+    elif jids_used:
       print('JID used by test matched me2me host JID: %s' % host_jid)
     else:
       # There wasn't a mismatch and no JIDs were returned. If no JIDs were
diff --git a/testing/scripts/__init__.py b/testing/scripts/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/testing/scripts/__init__.py
+++ /dev/null
diff --git a/testing/scripts/blink_lint_expectations.py b/testing/scripts/blink_lint_expectations.py
index c1f2ad9..bb26b91 100755
--- a/testing/scripts/blink_lint_expectations.py
+++ b/testing/scripts/blink_lint_expectations.py
@@ -7,10 +7,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/blink_python_tests.py b/testing/scripts/blink_python_tests.py
index a9c854b..c7f14e68 100755
--- a/testing/scripts/blink_python_tests.py
+++ b/testing/scripts/blink_python_tests.py
@@ -7,10 +7,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/check_gn_headers.py b/testing/scripts/check_gn_headers.py
index ccf0ba21..6530ada7 100755
--- a/testing/scripts/check_gn_headers.py
+++ b/testing/scripts/check_gn_headers.py
@@ -7,10 +7,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/check_network_annotations.py b/testing/scripts/check_network_annotations.py
index 7d05b49a..6e2875d8 100755
--- a/testing/scripts/check_network_annotations.py
+++ b/testing/scripts/check_network_annotations.py
@@ -12,10 +12,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/check_static_initializers.py b/testing/scripts/check_static_initializers.py
index dc9b1d27..3afd112 100755
--- a/testing/scripts/check_static_initializers.py
+++ b/testing/scripts/check_static_initializers.py
@@ -11,10 +11,7 @@
 import subprocess
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 # A list of files that are allowed to have static initializers.
 # If something adds a static initializer, revert it. We don't accept regressions
diff --git a/testing/scripts/checkbins.py b/testing/scripts/checkbins.py
index af8208dc..f66c8b1 100755
--- a/testing/scripts/checkbins.py
+++ b/testing/scripts/checkbins.py
@@ -21,14 +21,11 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 WIN_PY3_TARGETS = ['python3.exe', 'python3.bat']
 
-
 def with_python3():
   if sys.version_info.major >= 3:
     return sys.executable
diff --git a/testing/scripts/checkdeps.py b/testing/scripts/checkdeps.py
index 9c49d82..e772ae87 100755
--- a/testing/scripts/checkdeps.py
+++ b/testing/scripts/checkdeps.py
@@ -8,10 +8,7 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/checklicenses.py b/testing/scripts/checklicenses.py
index 3a51fcf6..43342d0 100755
--- a/testing/scripts/checklicenses.py
+++ b/testing/scripts/checklicenses.py
@@ -8,10 +8,7 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/checkperms.py b/testing/scripts/checkperms.py
index e635aa1..8adb025 100755
--- a/testing/scripts/checkperms.py
+++ b/testing/scripts/checkperms.py
@@ -8,10 +8,7 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/common.py b/testing/scripts/common.py
index d57595c..1c31066d 100644
--- a/testing/scripts/common.py
+++ b/testing/scripts/common.py
@@ -18,8 +18,7 @@
 logging.basicConfig(level=logging.INFO)
 
 # Add src/testing/ into sys.path for importing xvfb and test_env.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 import test_env
 if sys.platform.startswith('linux'):
   import xvfb
@@ -66,8 +65,6 @@
     '\\ALL RESTRICTED APPLICATION PACKAGES:(I)(OI)(CI)(RX)'
 ]
 
-# pylint: disable=useless-object-inheritance
-
 
 def set_lpac_acls(acl_dir, is_test_script=False):
   """Sets LPAC ACLs on a directory. Windows 10 only."""
@@ -234,7 +231,7 @@
   passing_statuses = ('PASS', 'SLOW', 'NEEDSREBASELINE')
 
   for test, result in convert_trie_to_flat_paths(
-      json_results['tests']).items():
+      json_results['tests']).iteritems():
     key = 'unexpected_' if result.get('is_unexpected') else ''
     data = result['actual']
     actual_results = data.split()
diff --git a/testing/scripts/content_shell_crash_test.py b/testing/scripts/content_shell_crash_test.py
index 60f76a75..fe3515a7 100755
--- a/testing/scripts/content_shell_crash_test.py
+++ b/testing/scripts/content_shell_crash_test.py
@@ -9,11 +9,11 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing xvfb and common.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
+import common
+
+# Add src/testing/ into sys.path for importing xvfb.
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 import xvfb
-from scripts import common
 
 
 # Unfortunately we need to copy these variables from ../test_env.py.
diff --git a/testing/scripts/count_filtered_tests.py b/testing/scripts/count_filtered_tests.py
index 588c87f..97bb8f54 100644
--- a/testing/scripts/count_filtered_tests.py
+++ b/testing/scripts/count_filtered_tests.py
@@ -9,10 +9,7 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def ParseTestList(test_list_contents):
diff --git a/testing/scripts/get_compile_targets.py b/testing/scripts/get_compile_targets.py
index 75e15dc9d..3772d50a 100755
--- a/testing/scripts/get_compile_targets.py
+++ b/testing/scripts/get_compile_targets.py
@@ -8,10 +8,7 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def main(argv):
@@ -54,11 +51,7 @@
         return rc
 
       with open(tempfile_path) as f:
-        # json.load() throws a ValueError for empty files
-        try:
-          results[filename] = json.load(f)
-        except ValueError:
-          pass
+        results[filename] = json.load(f)
 
   with open(args.output, 'w') as f:
     json.dump(results, f)
diff --git a/testing/scripts/gpu_integration_test_adapter.py b/testing/scripts/gpu_integration_test_adapter.py
index 6aae983e..8c12571 100644
--- a/testing/scripts/gpu_integration_test_adapter.py
+++ b/testing/scripts/gpu_integration_test_adapter.py
@@ -2,14 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import os
-import sys
-
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
-
+import common
 
 class GpuIntegrationTestAdapater(common.BaseIsolatedScriptArgsAdapter):
 
diff --git a/testing/scripts/grit_python_unittests.py b/testing/scripts/grit_python_unittests.py
index 9a2218e..532e4b1 100755
--- a/testing/scripts/grit_python_unittests.py
+++ b/testing/scripts/grit_python_unittests.py
@@ -11,10 +11,7 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/headless_python_unittests.py b/testing/scripts/headless_python_unittests.py
index 4e32907..881cff4a 100755
--- a/testing/scripts/headless_python_unittests.py
+++ b/testing/scripts/headless_python_unittests.py
@@ -7,10 +7,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
@@ -18,7 +16,7 @@
       os.path.dirname(__file__), os.path.pardir, os.path.pardir,
       'third_party', 'catapult', 'third_party', 'typ'))
   _AddToPathIfNeeded(typ_path)
-  import typ #pylint: disable=import-outside-toplevel
+  import typ
 
   top_level_dir = os.path.join(
       common.SRC_DIR, 'headless', 'lib', 'browser', 'devtools_api')
diff --git a/testing/scripts/host_info.py b/testing/scripts/host_info.py
index 86c8514..63e3b9ba 100755
--- a/testing/scripts/host_info.py
+++ b/testing/scripts/host_info.py
@@ -9,10 +9,7 @@
 import platform
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 def is_linux():
@@ -91,7 +88,7 @@
       v['ro.build.fingerprint'] for v in device_info if not v['denylisted']]
 
   def unique_build_details(index):
-    return sorted(list({v.split(':')[index] for v in details}))
+    return sorted(list(set([v.split(':')[index] for v in details])))
 
   parsed_details = {
     'device_names': unique_build_details(0),
diff --git a/testing/scripts/metrics_python_tests.py b/testing/scripts/metrics_python_tests.py
index 2746430..70770f41 100755
--- a/testing/scripts/metrics_python_tests.py
+++ b/testing/scripts/metrics_python_tests.py
@@ -9,10 +9,8 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+
+import common
 
 
 def main_run(args):
diff --git a/testing/scripts/run_android_wpt.py b/testing/scripts/run_android_wpt.py
index 0417a5775..db183b2 100755
--- a/testing/scripts/run_android_wpt.py
+++ b/testing/scripts/run_android_wpt.py
@@ -26,16 +26,12 @@
 # run_wpt_tests.py script.
 
 import json
-import os
 import sys
 
+import common
 
 from run_wpt_tests import WPTAdapter
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
 
 # This is not really a "script test" so does not need to manually add
 # any additional compile targets.
diff --git a/testing/scripts/run_android_wpt.pydeps b/testing/scripts/run_android_wpt.pydeps
index cba4c8d8..ac6fdf5 100644
--- a/testing/scripts/run_android_wpt.pydeps
+++ b/testing/scripts/run_android_wpt.pydeps
@@ -20,7 +20,6 @@
 //build/util/lib/results/__init__.py
 //build/util/lib/results/result_sink.py
 //build/util/lib/results/result_types.py
-//testing/scripts/__init__.py
 //testing/scripts/common.py
 //testing/scripts/run_android_wpt.py
 //testing/scripts/run_wpt_tests.py
diff --git a/testing/scripts/run_cast_core_tests.py b/testing/scripts/run_cast_core_tests.py
index 7d5e9e9..f94e106 100755
--- a/testing/scripts/run_cast_core_tests.py
+++ b/testing/scripts/run_cast_core_tests.py
@@ -19,13 +19,9 @@
 """
 
 import json
-import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 class CastCoreIntegrationTestAdapter(common.BaseIsolatedScriptArgsAdapter):
@@ -51,4 +47,4 @@
       'compile_targets': main_compile_targets,
     }
     sys.exit(common.run_script(sys.argv[1:], funcs))
-  sys.exit(main())
+  sys.exit(main())
\ No newline at end of file
diff --git a/testing/scripts/run_chromedriver_tests.py b/testing/scripts/run_chromedriver_tests.py
index 203ae32..b1f67ce 100755
--- a/testing/scripts/run_chromedriver_tests.py
+++ b/testing/scripts/run_chromedriver_tests.py
@@ -25,10 +25,7 @@
 import tempfile
 import traceback
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 class ChromeDriverAdapter(common.BaseIsolatedScriptArgsAdapter):
diff --git a/testing/scripts/run_devtools_check.py b/testing/scripts/run_devtools_check.py
index 9f9be63..104f5f72 100755
--- a/testing/scripts/run_devtools_check.py
+++ b/testing/scripts/run_devtools_check.py
@@ -21,11 +21,11 @@
 import sys
 
 
-# Add src/testing/ into sys.path for importing xvfb and common.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
+import common
+
+# Add src/testing/ into sys.path for importing xvfb.
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 import xvfb
-from scripts import common
 
 
 def main():
diff --git a/testing/scripts/run_finch_smoke_tests_android.py b/testing/scripts/run_finch_smoke_tests_android.py
index cd12b7e..e3d91220 100755
--- a/testing/scripts/run_finch_smoke_tests_android.py
+++ b/testing/scripts/run_finch_smoke_tests_android.py
@@ -19,7 +19,6 @@
 
 SRC_DIR = os.path.abspath(
     os.path.join(os.path.dirname(__file__), os.pardir, os.pardir))
-PAR_DIR = os.path.join(SRC_DIR, 'testing')
 OUT_DIR = os.path.join(SRC_DIR, 'out', 'Release')
 BLINK_TOOLS = os.path.join(
     SRC_DIR, 'third_party', 'blink', 'tools')
@@ -47,11 +46,10 @@
 if WEBVIEW_VARIATIONS_PROTO not in sys.path:
   sys.path.append(WEBVIEW_VARIATIONS_PROTO)
 
-sys.path.append(PAR_DIR)
-
 if 'compile_targets' not in sys.argv:
   import aw_variations_seed_pb2
 
+import common
 import devil_chromium
 import wpt_common
 
@@ -68,7 +66,6 @@
 from devil.utils import logging_common
 from pylib.local.emulator import avd
 from py_utils.tempfile_ext import NamedTemporaryDirectory
-from scripts import common
 from skia_gold_infra.finch_skia_gold_properties import FinchSkiaGoldProperties
 from skia_gold_infra import finch_skia_gold_session_manager
 from skia_gold_infra import finch_skia_gold_utils
@@ -85,8 +82,6 @@
 logger.setLevel(logging.INFO)
 TEST_CASES = {}
 
-# pylint: disable=super-with-arguments
-
 
 class FinchTestCase(wpt_common.BaseWptScriptAdapter):
 
@@ -100,7 +95,6 @@
     self.browser_activity_name = (self.options.browser_activity_name or
                                   self.default_browser_activity_name)
     self.log_mon = None
-    self.layout_test_results_subdir = None
     self.test_specific_browser_args = []
     if self.options.webview_provider_apk:
       self.webview_provider_package_name = (
diff --git a/testing/scripts/run_flatbuffers_unittests.py b/testing/scripts/run_flatbuffers_unittests.py
index daea0f5..c9b8fde9 100755
--- a/testing/scripts/run_flatbuffers_unittests.py
+++ b/testing/scripts/run_flatbuffers_unittests.py
@@ -20,14 +20,11 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing xvfb and common.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
+import common
+
+# Add src/testing/ into sys.path for importing xvfb and test_env.
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 import xvfb
-from scripts import common
-
-# pylint: disable=super-with-arguments
-
 
 def main():
   parser = argparse.ArgumentParser()
diff --git a/testing/scripts/run_gpu_integration_test_as_googletest.py b/testing/scripts/run_gpu_integration_test_as_googletest.py
index 3456a7e..dc5e128 100755
--- a/testing/scripts/run_gpu_integration_test_as_googletest.py
+++ b/testing/scripts/run_gpu_integration_test_as_googletest.py
@@ -19,16 +19,11 @@
 """
 
 import json
-import os
 import sys
 
+import common
 import gpu_integration_test_adapter
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
-
 
 def main():
   adapter = gpu_integration_test_adapter.GpuIntegrationTestAdapater()
diff --git a/testing/scripts/run_isolated_script_test.py b/testing/scripts/run_isolated_script_test.py
index 0e963d6..fed58832 100755
--- a/testing/scripts/run_isolated_script_test.py
+++ b/testing/scripts/run_isolated_script_test.py
@@ -26,11 +26,7 @@
 import tempfile
 
 
-# Add src/testing/ into sys.path for importing xvfb and common.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-import xvfb
-from scripts import common
+import common
 
 
 # Some harnesses understand the --isolated-script-test arguments
@@ -56,9 +52,10 @@
     'test_suite_all.py',  # //tools/grit:grit_python_unittests
 }
 
-# pylint: disable=super-with-arguments
-
 class IsolatedScriptTestAdapter(common.BaseIsolatedScriptArgsAdapter):
+  def __init__(self):
+    super(IsolatedScriptTestAdapter, self).__init__()
+
   def generate_sharding_args(self, total_shards, shard_index):
     # This script only uses environment variable for sharding.
     del total_shards, shard_index  # unused
@@ -121,6 +118,9 @@
       return 'vpython3.bat' if sys.platform == 'win32' else 'vpython3'
     return super(TypUnittestAdapter, self).select_python_executable()
 
+  def run_test(self):
+    return super(TypUnittestAdapter, self).run_test()
+
 
 def main():
   if any(r in sys.argv[1] for r in KNOWN_ISOLATED_SCRIPT_TEST_RUNNERS):
diff --git a/testing/scripts/run_isolated_script_test.pydeps b/testing/scripts/run_isolated_script_test.pydeps
index df35f82..bc8ff58 100644
--- a/testing/scripts/run_isolated_script_test.pydeps
+++ b/testing/scripts/run_isolated_script_test.pydeps
@@ -4,7 +4,6 @@
 //build/util/lib/results/__init__.py
 //build/util/lib/results/result_sink.py
 //build/util/lib/results/result_types.py
-//testing/scripts/__init__.py
 //testing/scripts/common.py
 //testing/scripts/run_isolated_script_test.py
 //testing/test_env.py
diff --git a/testing/scripts/run_performance_tests.py b/testing/scripts/run_performance_tests.py
index a46efbe5..b687be8 100755
--- a/testing/scripts/run_performance_tests.py
+++ b/testing/scripts/run_performance_tests.py
@@ -48,11 +48,11 @@
 import traceback
 import six
 
+import common
 from collections import OrderedDict
 
 CHROMIUM_SRC_DIR = os.path.abspath(
-    os.path.join(os.path.dirname(__file__),
-                 os.path.pardir, os.path.pardir))
+    os.path.join(os.path.dirname(__file__), '..', '..'))
 
 PERF_DIR = os.path.join(CHROMIUM_SRC_DIR, 'tools', 'perf')
 sys.path.append(PERF_DIR)
@@ -63,21 +63,19 @@
 sys.path.append(PERF_CORE_DIR)
 import results_merger
 
-# Add src/testing/ into sys.path for importing xvfb, test_env, and common.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
+# Add src/testing/ into sys.path for importing xvfb and test_env.
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 import xvfb
 import test_env
-from scripts import common
 
 # Unfortunately we need to copy these variables from ../test_env.py.
 # Importing it and using its get_sandbox_env breaks test runs on Linux
 # (it seems to unset DISPLAY).
 CHROME_SANDBOX_ENV = 'CHROME_DEVEL_SANDBOX'
 CHROME_SANDBOX_PATH = '/opt/chromium/chrome_sandbox'
-SHARD_MAPS_DIRECTORY = os.path.abspath(
-    os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir,
-                 'tools', 'perf', 'core', 'shard_maps'))
+SHARD_MAPS_DIRECTORY = os.path.join(
+    os.path.dirname(__file__), '..', '..', 'tools', 'perf', 'core',
+    'shard_maps')
 
 # See https://crbug.com/923564.
 # We want to switch over to using histograms for everything, but converting from
@@ -108,8 +106,6 @@
   'xr.vr.common_perftests',
 ]
 
-# pylint: disable=useless-object-inheritance
-
 
 class OutputFilePaths(object):
   """Provide paths to where results outputs should be written.
@@ -192,7 +188,8 @@
     executable = str(self.executable_name)
     if IsWindows():
       return r'.\%s.exe' % executable
-    return './%s' % executable
+    else:
+      return './%s' % executable
 
   def _get_additional_flags(self):
     return self._additional_flags
@@ -249,7 +246,7 @@
           benchmark_name: {
               'expected': 'PASS',
               'actual': 'FAIL' if return_code else 'PASS',
-              'is_unexpected': bool(return_code),
+              'is_unexpected': True if return_code else False,
           },
       },
       'interrupted': False,
@@ -356,9 +353,9 @@
   if os.path.exists(output_paths.perf_results):
     if command_generator.executable_name in GTEST_CONVERSION_WHITELIST:
       with path_util.SysPath(path_util.GetTracingDir()):
-        # pylint: disable=no-name-in-module,import-outside-toplevel
+        # pylint: disable=no-name-in-module
         from tracing.value import gtest_json_converter
-        # pylint: enable=no-name-in-module,import-outside-toplevel
+        # pylint: enable=no-name-in-module
       gtest_json_converter.ConvertGtestJsonFile(output_paths.perf_results)
   else:
     print('ERROR: gtest perf test %s did not generate perf output' %
diff --git a/testing/scripts/run_rendering_benchmark_with_gated_performance.py b/testing/scripts/run_rendering_benchmark_with_gated_performance.py
index 39537a0..1011ac3 100755
--- a/testing/scripts/run_rendering_benchmark_with_gated_performance.py
+++ b/testing/scripts/run_rendering_benchmark_with_gated_performance.py
@@ -26,13 +26,9 @@
 
 import numpy as np
 
+import common
 import run_performance_tests
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
-
 # AVG_ERROR_MARGIN determines how much more the value of frame times can be
 # compared to the recorded value (multiplier of upper limit).
 AVG_ERROR_MARGIN = 1.1
@@ -44,9 +40,6 @@
 
 METRIC_NAME = 'frame_times'
 
-# pylint: disable=useless-object-inheritance
-
-
 class ResultRecorder(object):
   def __init__(self):
     self.fails = 0
@@ -159,7 +152,7 @@
     # least by 10 [AVG_ERROR_MARGIN] percent of upper limit, that would be
     # considered a failure. crbug.com/953895
     with open(
-      os.path.join(os.path.dirname(os.path.abspath(__file__)),
+      os.path.join(os.path.dirname(__file__),
       'representative_perf_test_data',
       'representatives_frame_times_upper_limit.json')
     ) as bound_data:
diff --git a/testing/scripts/run_telemetry_as_googletest.py b/testing/scripts/run_telemetry_as_googletest.py
index b67063bb..e05f733 100755
--- a/testing/scripts/run_telemetry_as_googletest.py
+++ b/testing/scripts/run_telemetry_as_googletest.py
@@ -23,10 +23,7 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 
 class TelemetryUnittestAdapter(common.BaseIsolatedScriptArgsAdapter):
diff --git a/testing/scripts/run_variations_smoke_tests.py b/testing/scripts/run_variations_smoke_tests.py
index 1bba02f..b681e54a 100755
--- a/testing/scripts/run_variations_smoke_tests.py
+++ b/testing/scripts/run_variations_smoke_tests.py
@@ -21,12 +21,12 @@
 from skia_gold_infra.finch_skia_gold_properties import FinchSkiaGoldProperties
 from skia_gold_infra import finch_skia_gold_utils
 
+import common
 import variations_seed_access_helper as seed_helper
 
 _THIS_DIR = os.path.abspath(os.path.dirname(__file__))
 _VARIATIONS_TEST_DATA = 'variations_smoke_test_data'
 
-from . import common
 from selenium import webdriver
 from selenium.webdriver import ChromeOptions
 from selenium.common.exceptions import NoSuchElementException
@@ -84,7 +84,7 @@
     'Windows (win32 or cygwin) are supported' % sys.platform)
 
 
-def _find_chrome_binary(): #pylint: disable=inconsistent-return-statements
+def _find_chrome_binary():
   """Finds and returns the relative path to the Chrome binary.
 
   This function assumes that the CWD is the build directory.
@@ -95,11 +95,11 @@
   platform = _get_platform()
   if platform == 'linux':
     return os.path.join('.', 'chrome')
-  if platform == 'mac':
+  elif platform == 'mac':
     chrome_name = 'Google Chrome'
     return os.path.join('.', chrome_name + '.app', 'Contents', 'MacOS',
                             chrome_name)
-  if platform == 'win':
+  elif platform == 'win':
     return os.path.join('.', 'chrome.exe')
 
 
diff --git a/testing/scripts/run_wpt_tests.py b/testing/scripts/run_wpt_tests.py
index 2e7c0ff..d592d83 100755
--- a/testing/scripts/run_wpt_tests.py
+++ b/testing/scripts/run_wpt_tests.py
@@ -12,13 +12,9 @@
 import os
 import sys
 
+import common
 import wpt_common
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
-
 logger = logging.getLogger(__name__)
 
 SRC_DIR = os.path.abspath(
@@ -58,7 +54,6 @@
     _ANDROID_ENABLED = False
 
 
-# pylint: disable=super-with-arguments
 def _make_pass_through_action(dest, map_arg=lambda arg: arg):
     class PassThroughAction(argparse.Action):
         def __init__(self, option_strings, dest, nargs=None, **kwargs):
@@ -179,7 +174,7 @@
   def log_level(self):
     if self.options.verbose >= 2:
       return logging.DEBUG
-    if self.options.verbose >= 1:
+    elif self.options.verbose >= 1:
       return logging.INFO
     return logging.WARNING
 
@@ -436,7 +431,7 @@
     def wpt_args(self):
         """list[str]: Arguments to add to a 'wpt run' command."""
         args = []
-        version = self.get_version() # pylint: disable=assignment-from-none
+        version = self.get_version()
         if version:
             args.append('--browser-version=%s' % version)
         webdriver = self.webdriver_binary
@@ -669,7 +664,7 @@
                              self).get_browser_package_name()
         if package_name:
             return package_name
-        if self._options.shell_apk:
+        elif self._options.shell_apk:
             with contextlib.suppress(apk_helper.ApkHelperError):
                 return apk_helper.GetPackageName(self._options.shell_apk)
         return None
@@ -713,11 +708,12 @@
             return webview_app.UseWebViewProvider(
                 device,
                 self._options.webview_provider)
-        assert self._options.release_channel, 'no webview install method'
-        return _install_webview_from_release(
-            device,
-            self._options.release_channel,
-            self._python_executable)
+        else:
+            assert self._options.release_channel, 'no webview install method'
+            return _install_webview_from_release(
+                device,
+                self._options.release_channel,
+                self._python_executable)
 
     def _validate_options(self):
         super(WebView, self)._validate_options()
@@ -760,7 +756,7 @@
         package_name = super(ChromeAndroid, self).get_browser_package_name()
         if package_name:
             return package_name
-        if self._options.apk:
+        elif self._options.apk:
             with contextlib.suppress(apk_helper.ApkHelperError):
                 return apk_helper.GetPackageName(self._options.apk[0])
         return None
diff --git a/testing/scripts/rust/rust_main_program.py b/testing/scripts/rust/rust_main_program.py
index a1f95202..080dd2b 100644
--- a/testing/scripts/rust/rust_main_program.py
+++ b/testing/scripts/rust/rust_main_program.py
@@ -11,7 +11,7 @@
 import subprocess
 import sys
 
-sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+sys.path.append(os.path.dirname(__file__))
 import exe_util
 import main_program
 import test_results
diff --git a/testing/scripts/rust/test_filtering.py b/testing/scripts/rust/test_filtering.py
index bc9c7eea..a386dd0 100644
--- a/testing/scripts/rust/test_filtering.py
+++ b/testing/scripts/rust/test_filtering.py
@@ -56,7 +56,8 @@
         """
         if self._is_prefix_match:
             return test_name.startswith(self._filter_text)
-        return test_name == self._filter_text
+        else:
+            return test_name == self._filter_text
 
     def is_exclusion_filter(self):
         """Rreturns whether this filter excludes (rather than includes) matching
diff --git a/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py b/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
index 8d6d3d3..a6784bfb 100644
--- a/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
+++ b/testing/scripts/skia_gold_infra/finch_skia_gold_utils.py
@@ -134,3 +134,4 @@
         'Given unhandled SkiaGoldSession StatusCode %s with error %s', status,
         error)
   return triage_link
+
diff --git a/testing/scripts/test_buildbucket_api_gpu_use_cases.py b/testing/scripts/test_buildbucket_api_gpu_use_cases.py
index b4652a6c..af2b7f8 100755
--- a/testing/scripts/test_buildbucket_api_gpu_use_cases.py
+++ b/testing/scripts/test_buildbucket_api_gpu_use_cases.py
@@ -10,15 +10,11 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 # Add src/content/test/gpu into sys.path for importing common.
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
-                                os.path.pardir, os.path.pardir, 'content',
-                                'test', 'gpu')))
+sys.path.append(os.path.join(os.path.dirname(__file__),
+                             '..', '..', 'content', 'test', 'gpu'))
 
 import gather_power_measurement_results
 import gather_swarming_json_results
diff --git a/testing/scripts/test_traffic_annotation_auditor.py b/testing/scripts/test_traffic_annotation_auditor.py
index bcd0fb1..01f6399 100755
--- a/testing/scripts/test_traffic_annotation_auditor.py
+++ b/testing/scripts/test_traffic_annotation_auditor.py
@@ -15,10 +15,7 @@
 import tempfile
 import traceback
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 WINDOWS_SHEET_CONFIG = {
   "spreadsheet_id": "1TmBr9jnf1-hrjntiVBzT9EtkINGrtoBYFMWad2MBeaY",
diff --git a/testing/scripts/wpt_common.py b/testing/scripts/wpt_common.py
index 33cb0c3..4a86345 100644
--- a/testing/scripts/wpt_common.py
+++ b/testing/scripts/wpt_common.py
@@ -8,10 +8,7 @@
 import os
 import sys
 
-# Add src/testing/ into sys.path for importing common without pylint errors.
-sys.path.append(
-    os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir)))
-from scripts import common
+import common
 
 BLINK_TOOLS_DIR = os.path.join(common.SRC_DIR, 'third_party', 'blink', 'tools')
 CATAPULT_DIR = os.path.join(common.SRC_DIR, 'third_party', 'catapult')
@@ -33,7 +30,6 @@
 logger = logging.getLogger(__name__)
 
 
-# pylint: disable=super-with-arguments
 class BaseWptScriptAdapter(common.BaseIsolatedScriptArgsAdapter):
     """The base class for script adapters that use wptrunner to execute web
     platform tests. This contains any code shared between these scripts, such
@@ -214,7 +210,6 @@
     def generate_test_repeat_args(self, repeat_count):
         return ['--repeat=%d' % repeat_count]
 
-    # pylint: disable=unused-argument
     def generate_test_launcher_retry_limit_args(self, retry_limit):
         # TODO(crbug/1306222): wptrunner currently cannot rerun individual
         # failed tests, so this flag is accepted but not used.
diff --git a/testing/test_env.py b/testing/test_env.py
index 43083fc..fa8df4c 100755
--- a/testing/test_env.py
+++ b/testing/test_env.py
@@ -289,15 +289,13 @@
       if p.poll() is not None:
         continue
       # SIGBREAK is defined only for win32.
-      # pylint: disable=no-member
       if sys.platform == 'win32' and sig == signal.SIGBREAK:
         p.send_signal(signal.CTRL_BREAK_EVENT)
       else:
         print("Forwarding signal(%d) to process %d" % (sig, p.pid))
         p.send_signal(sig)
-      # pylint: enable=no-member
   if sys.platform == 'win32':
-    signal.signal(signal.SIGBREAK, _sig_handler) # pylint: disable=no-member
+    signal.signal(signal.SIGBREAK, _sig_handler)
   else:
     signal.signal(signal.SIGTERM, _sig_handler)
     signal.signal(signal.SIGINT, _sig_handler)
@@ -351,13 +349,11 @@
   if '--coverage-continuous-mode=1' in cmd:
     extra_env.update(get_coverage_continuous_mode_env(env))
 
-  # pylint: disable=import-outside-toplevel
   if '--skip-set-lpac-acls=1' not in cmd and sys.platform == 'win32':
     sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
         'scripts'))
-    from scripts import common
+    import common
     common.set_lpac_acls(ROOT_DIR, is_test_script=True)
-  # pylint: enable=import-outside-toplevel
 
   cmd = trim_cmd(cmd)
 
@@ -383,7 +379,7 @@
     if stdoutfile:
       # Write to stdoutfile and poll to produce terminal output.
       return run_command_with_output(cmd, env=env, stdoutfile=stdoutfile)
-    if use_symbolization_script:
+    elif use_symbolization_script:
       # See above comment regarding offline symbolization.
       # Need to pipe to the symbolizer script.
       p1 = _popen(cmd, env=env, stdout=subprocess.PIPE,
@@ -398,7 +394,8 @@
       # Also feed the out-of-band JSON output to the symbolizer script.
       symbolize_snippets_in_json(cmd, env)
       return p1.returncode
-    return run_command(cmd, env=env, log=False)
+    else:
+      return run_command(cmd, env=env, log=False)
   except OSError:
     print('Failed to start %s' % cmd, file=sys.stderr)
     raise
diff --git a/testing/test_env_test_script.py b/testing/test_env_test_script.py
index e318141..4957ee65 100755
--- a/testing/test_env_test_script.py
+++ b/testing/test_env_test_script.py
@@ -19,5 +19,5 @@
   signal.signal(signal.SIGTERM, print_signal)
   signal.signal(signal.SIGINT, print_signal)
   if sys.platform == 'win32':
-    signal.signal(signal.SIGBREAK, print_signal) # pylint: disable=no-member
+    signal.signal(signal.SIGBREAK, print_signal)
   time.sleep(2)  # gives process time to receive signal.
diff --git a/testing/test_env_unittest.py b/testing/test_env_unittest.py
index 8ec6194..707c65e 100755
--- a/testing/test_env_unittest.py
+++ b/testing/test_env_unittest.py
@@ -20,8 +20,6 @@
 HERE = os.path.dirname(os.path.abspath(__file__))
 TEST_SCRIPT = os.path.join(HERE, 'test_env_user_script.py')
 
-# pylint: disable=super-with-arguments
-
 
 def launch_process_windows(args):
   # The `universal_newlines` option is equivalent to `text` in Python 3.
@@ -44,13 +42,11 @@
       universal_newlines=True)
 
 
-# pylint: disable=inconsistent-return-statements
 def read_subprocess_message(proc, starts_with):
   """Finds the value after first line prefix condition."""
   for line in proc.stdout:
     if line.startswith(starts_with):
       return line.rstrip().replace(starts_with, '')
-# pylint: enable=inconsistent-return-statements
 
 
 def send_and_wait(proc, sig, sleep_time=0.3):
@@ -69,9 +65,9 @@
 
   def test_send_ctrl_break_event(self):
     proc = launch_process_windows([])
-    send_and_wait(proc, signal.CTRL_BREAK_EVENT) # pylint: disable=no-member
+    send_and_wait(proc, signal.CTRL_BREAK_EVENT)
     sig = read_subprocess_message(proc, 'Signal :')
-    self.assertEqual(sig, str(int(signal.SIGBREAK))) # pylint: disable=no-member
+    self.assertEqual(sig, str(int(signal.SIGBREAK)))
 
 
 class SignalingNonWindowsTest(unittest.TestCase):
diff --git a/testing/unexpected_passes_common/unittest_utils.py b/testing/unexpected_passes_common/unittest_utils.py
index bfc3b405..2df2f251 100644
--- a/testing/unexpected_passes_common/unittest_utils.py
+++ b/testing/unexpected_passes_common/unittest_utils.py
@@ -141,15 +141,11 @@
 
 
 class GenericBuilders(builders.Builders):
-  #pylint: disable=useless-super-delegation
   def __init__(self, include_internal_builders=False):
     super(GenericBuilders, self).__init__(include_internal_builders)
-  #pylint: enable=useless-super-delegation
 
-  #pylint: disable=unused-argument
   def _BuilderRunsTestOfInterest(self, test_map, suite):
     return True
-  #pylint: enable=unused-argument
 
   def GetIsolateNames(self):
     return {}
diff --git a/testing/variations/PRESUBMIT.py b/testing/variations/PRESUBMIT.py
index fe53483..e854e16 100644
--- a/testing/variations/PRESUBMIT.py
+++ b/testing/variations/PRESUBMIT.py
@@ -257,10 +257,10 @@
           json_data,
           f.AbsoluteLocalPath(),
           output_api.PresubmitError)
-      if result:
+      if len(result):
         return result
       result = CheckPretty(contents, f.LocalPath(), output_api.PresubmitError)
-      if result:
+      if len(result):
         return result
     except ValueError:
       return [
diff --git a/testing/xvfb.py b/testing/xvfb.py
index a301e55a..c1f5f76 100755
--- a/testing/xvfb.py
+++ b/testing/xvfb.py
@@ -23,15 +23,15 @@
 
 import test_env
 
-# pylint: disable=useless-object-inheritance
-
 
 class _XvfbProcessError(Exception):
   """Exception raised when Xvfb cannot start."""
+  pass
 
 
 class _WestonProcessError(Exception):
   """Exception raised when Weston cannot start."""
+  pass
 
 
 def kill(proc, name, timeout_in_seconds=10):
@@ -54,7 +54,7 @@
           file=sys.stderr)
 
 
-def launch_dbus(env): # pylint: disable=inconsistent-return-statements
+def launch_dbus(env):
   """Starts a DBus session.
 
   Works around a bug in GLib where it performs operations which aren't
@@ -136,9 +136,10 @@
 
   if sys.platform.startswith('linux') and use_xvfb:
     return _run_with_xvfb(cmd, env, stdoutfile, use_openbox, use_xcompmgr)
-  if use_weston:
+  elif use_weston:
     return _run_with_weston(cmd, env, stdoutfile)
-  return test_env.run_executable(cmd, env, stdoutfile)
+  else:
+    return test_env.run_executable(cmd, env, stdoutfile)
 
 
 def _run_with_xvfb(cmd, env, stdoutfile, use_openbox, use_xcompmgr):
diff --git a/testing/xvfb_unittest.py b/testing/xvfb_unittest.py
index 47b78f8..f28b6d2 100755
--- a/testing/xvfb_unittest.py
+++ b/testing/xvfb_unittest.py
@@ -16,8 +16,6 @@
 import time
 import unittest
 
-# pylint: disable=super-with-arguments
-
 
 TEST_FILE = __file__.replace('.pyc', '.py')
 XVFB = TEST_FILE.replace('_unittest', '')
@@ -31,13 +29,11 @@
       stderr=subprocess.STDOUT, env=os.environ.copy())
 
 
-# pylint: disable=inconsistent-return-statements
 def read_subprocess_message(proc, starts_with):
   """Finds the value after first line prefix condition."""
-  for line in proc.stdout.read().decode('utf-8').splitlines(True):
+  for line in proc.stdout:
     if line.startswith(starts_with):
       return line.rstrip().replace(starts_with, '')
-# pylint: enable=inconsistent-return-statements
 
 
 def send_signal(proc, sig, sleep_time=0.3):
@@ -51,7 +47,7 @@
 
   def setUp(self):
     super(XvfbLinuxTest, self).setUp()
-    if sys.platform != 'linux':
+    if sys.platform != 'linux2':
       self.skipTest('linux only test')
 
   def test_no_xvfb_display(self):
@@ -96,13 +92,13 @@
     proc = launch_process(['--sleep'])
     send_signal(proc, signal.SIGINT, 1)
     sig = read_subprocess_message(proc, 'Signal :')
-    self.assertEqual(int(sig), int(signal.SIGINT))
+    self.assertEqual(sig, str(signal.SIGINT))
 
   def test_send_sigterm(self):
     proc = launch_process(['--sleep'])
     send_signal(proc, signal.SIGTERM, 1)
     sig = read_subprocess_message(proc, 'Signal :')
-    self.assertEqual(int(sig), int(signal.SIGTERM))
+    self.assertEqual(sig, str(signal.SIGTERM))
 
 if __name__ == '__main__':
   unittest.main()