Bug 1659061 [wpt PR 25008] - Replace os.path.split with .dirname or .basename where appropriate, a=testonly
authormoz-wptsync-bot <wptsync@mozilla.com>
Fri, 21 Aug 2020 09:27:43 +0000
changeset 546041 d5e389a47637c046dbd9a2c52cd78880970d9544
parent 546040 a0ae947d26da50b9fafb8e06d4bdd9405d8cfcb3
child 546042 ae403c34904ae517f1b1976d70d79d7eb75a8dea
push id37730
push userabutkovits@mozilla.com
push dateTue, 25 Aug 2020 15:44:12 +0000
treeherdermozilla-central@a8f04609cdd8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1659061, 25008
milestone82.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 1659061 [wpt PR 25008] - Replace os.path.split with .dirname or .basename where appropriate, a=testonly Automatic update from web-platform-tests Replace os.path.split with .dirname or .basename where appropriate (#25008) Most of the changes made by: > git grep -lF os.path.split | xargs sed -i '' 's/os\.path\.split(\(.*\))\[0\]/os.path.dirname(\1)/g' That gets some things wrong, so all changes were vetted and some fixed or simplified. -- wpt-commits: 0f986ae5b0865c0bef78e41e35d144e30a14b2e7 wpt-pr: 25008
testing/web-platform/tests/annotation-protocol/tools/protocol-server.py
testing/web-platform/tests/css/tools/w3ctestlib/Utils.py
testing/web-platform/tests/eventsource/resources/cors.py
testing/web-platform/tests/html/tools/update_html5lib_tests.py
testing/web-platform/tests/tools/localpaths.py
testing/web-platform/tests/tools/wptrunner/setup.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/sauce.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servo.py
testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
testing/web-platform/tests/tools/wptrunner/wptrunner/config.py
testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorchrome.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorselenium.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py
testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
testing/web-platform/tests/tools/wptrunner/wptrunner/font.py
testing/web-platform/tests/tools/wptrunner/wptrunner/metadata.py
testing/web-platform/tests/tools/wptrunner/wptrunner/tests/__init__.py
testing/web-platform/tests/tools/wptrunner/wptrunner/update/state.py
testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
testing/web-platform/tests/tools/wptserve/tests/functional/base.py
testing/web-platform/tests/tools/wptserve/wptserve/handlers.py
testing/web-platform/tests/xhr/resources/auth1/auth.py
testing/web-platform/tests/xhr/resources/auth10/auth.py
testing/web-platform/tests/xhr/resources/auth11/auth.py
testing/web-platform/tests/xhr/resources/auth2/auth.py
testing/web-platform/tests/xhr/resources/auth3/auth.py
testing/web-platform/tests/xhr/resources/auth4/auth.py
testing/web-platform/tests/xhr/resources/auth9/auth.py
--- a/testing/web-platform/tests/annotation-protocol/tools/protocol-server.py
+++ b/testing/web-platform/tests/annotation-protocol/tools/protocol-server.py
@@ -9,17 +9,17 @@
 #
 # for license information, see http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
 
 from __future__ import print_function
 
 import os
 import sys
 
-here = os.path.abspath(os.path.split(__file__)[0])
+here = os.path.abspath(os.path.dirname(__file__))
 repo_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
 
 sys.path.insert(0, os.path.join(repo_root, "tools"))
 sys.path.insert(0, os.path.join(repo_root, "tools", "six"))
 sys.path.insert(0, os.path.join(repo_root, "tools", "html5lib"))
 sys.path.insert(0, os.path.join(repo_root, "tools", "wptserve"))
 sys.path.insert(0, os.path.join(repo_root, "tools", "pywebsocket", "src"))
 sys.path.insert(0, os.path.join(repo_root, "tools", "py"))
--- a/testing/web-platform/tests/css/tools/w3ctestlib/Utils.py
+++ b/testing/web-platform/tests/css/tools/w3ctestlib/Utils.py
@@ -15,17 +15,17 @@ import os.path
 from os.path import sep, pardir
 
 def assetName(path):
   return intern(os.path.splitext(os.path.basename(path))[0].lower().encode('ascii'))
   
 def basepath(path):
   """ Returns the path part of os.path.split.
   """
-  return os.path.split(path)[0]
+  return os.path.dirname(path)
 
 def isPathInsideBase(path, base=''):
   path = os.path.normpath(path)
   if base:
     base = os.path.normpath(base)
     pathlist = path.split(os.path.sep)
     baselist = base.split(os.path.sep)
     while baselist:
--- a/testing/web-platform/tests/eventsource/resources/cors.py
+++ b/testing/web-platform/tests/eventsource/resources/cors.py
@@ -26,11 +26,11 @@ def main(request, response):
             response.headers.set(b"Content-Type", b"text/event-stream")
             rv = open(os.path.join(request.doc_root, u"eventsource", u"resources", u"cache-control.event_stream"), u"r").read()
             response.content = rv
             pipes.sub(request, response)
             return
         elif handler == b"redirect":
             return run_other(request, response, os.path.join(request.doc_root, u"common", u"redirect.py"))
         else:
-            return run_other(request, response, os.path.join(os.path.split(isomorphic_decode(__file__))[0], isomorphic_decode(handler) + u".py"))
+            return run_other(request, response, os.path.join(os.path.dirname(isomorphic_decode(__file__)), isomorphic_decode(handler) + u".py"))
     else:
         return
--- a/testing/web-platform/tests/html/tools/update_html5lib_tests.py
+++ b/testing/web-platform/tests/html/tools/update_html5lib_tests.py
@@ -32,27 +32,27 @@ pip install -e ./
 
 Then run this script again, with the virtual environment still active.
 When you are done, type "deactivate" to deactivate the virtual environment.
 """)
 
 TESTS_PATH = "html/syntax/parsing/"
 
 def get_paths():
-    script_path = os.path.split(os.path.abspath(__file__))[0]
+    script_path = os.path.dirname(os.path.abspath(__file__))
     repo_base = get_repo_base(script_path)
     tests_path = os.path.join(repo_base, TESTS_PATH)
     return script_path, tests_path
 
 def get_repo_base(path):
     while path:
         if os.path.exists(os.path.join(path, ".git")):
             return path
         else:
-            path = os.path.split(path)[0]
+            path = os.path.dirname(path)
 
 def get_expected(data):
     data = "#document\n" + data
     return data
 
 def get_hash(data, container=None):
     if container == None:
         container = ""
@@ -95,17 +95,17 @@ def make_tests(script_dir, out_dir, inpu
         path_innerHTML = write_test_file(script_dir, out_dir,
                                          innerHTML_tests, "html5lib_innerHTML_%s"%input_file_name,
                                          "html5lib_test_fragment.xml")
 
     return path_normal, path_innerHTML
 
 def write_test_file(script_dir, out_dir, tests, file_name, template_file_name):
     file_name = os.path.join(out_dir, file_name + ".html")
-    short_name = os.path.split(file_name)[1]
+    short_name = os.path.basename(file_name)
 
     with open(os.path.join(script_dir, template_file_name), "r") as f:
         template = MarkupTemplate(f)
 
     stream = template.generate(file_name=short_name, tests=tests)
 
     with open(file_name, "w") as f:
         f.write(stream.render('html', doctype='html5',
@@ -134,17 +134,17 @@ def main():
         test_iterator = itertools.chain(
             itertools.izip(itertools.repeat(False),
                            sorted(support.get_data_files("tree-construction"))),
             itertools.izip(itertools.repeat(True),
                            sorted(support.get_data_files(
                         os.path.join("tree-construction", "scripted")))))
 
     for (scripted, test_file) in test_iterator:
-        input_file_name = os.path.splitext(os.path.split(test_file)[1])[0]
+        input_file_name = os.path.splitext(os.path.basename(test_file))[0]
         if scripted:
             input_file_name = "scripted_" + input_file_name
         test_data = support.TestData(test_file)
         test_filename, inner_html_file_name = make_tests(script_dir, out_dir,
                                                          input_file_name, test_data)
         if test_filename is not None:
             test_files.append(test_filename)
         if inner_html_file_name is not None:
--- a/testing/web-platform/tests/tools/localpaths.py
+++ b/testing/web-platform/tests/tools/localpaths.py
@@ -1,12 +1,12 @@
 import os
 import sys
 
-here = os.path.abspath(os.path.split(__file__)[0])
+here = os.path.abspath(os.path.dirname(__file__))
 
 sys.path.insert(0, os.path.join(here))
 sys.path.insert(0, os.path.join(here, "wptserve"))
 sys.path.insert(0, os.path.join(here, "third_party", "pywebsocket3"))
 sys.path.insert(0, os.path.join(here, "third_party", "atomicwrites"))
 sys.path.insert(0, os.path.join(here, "third_party", "attrs", "src"))
 sys.path.insert(0, os.path.join(here, "third_party", "funcsigs"))
 sys.path.insert(0, os.path.join(here, "third_party", "html5lib"))
--- a/testing/web-platform/tests/tools/wptrunner/setup.py
+++ b/testing/web-platform/tests/tools/wptrunner/setup.py
@@ -6,17 +6,17 @@ from __future__ import print_function
 
 import glob
 import os
 import sys
 import textwrap
 
 from setuptools import setup, find_packages
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 
 PACKAGE_NAME = 'wptrunner'
 PACKAGE_VERSION = '1.14'
 
 # Dependencies
 with open(os.path.join(here, "requirements.txt")) as f:
     deps = f.read().splitlines()
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py
@@ -2,17 +2,17 @@ import os
 import platform
 import socket
 from abc import ABCMeta, abstractmethod
 from copy import deepcopy
 from six import iteritems
 
 from ..wptcommandline import require_arg  # noqa: F401
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 
 
 def inherit(super_module, child_globals, product_name):
     super_wptrunner = super_module.__wptrunner__
     child_globals["__wptrunner__"] = child_wptrunner = deepcopy(super_wptrunner)
 
     child_wptrunner["product"] = product_name
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/firefox.py
@@ -25,17 +25,17 @@ from ..executors import executor_kwargs 
 from ..executors.executormarionette import (MarionetteTestharnessExecutor,  # noqa: F401
                                             MarionetteRefTestExecutor,  # noqa: F401
                                             MarionettePrintRefTestExecutor,  # noqa: F401
                                             MarionetteWdspecExecutor,  # noqa: F401
                                             MarionetteCrashtestExecutor)  # noqa: F401
 from ..process import cast_env
 
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 __wptrunner__ = {"product": "firefox",
                  "check_args": "check_args",
                  "browser": "FirefoxBrowser",
                  "executor": {"crashtest": "MarionetteCrashtestExecutor",
                               "testharness": "MarionetteTestharnessExecutor",
                               "reftest": "MarionetteRefTestExecutor",
                               "print-reftest": "MarionettePrintRefTestExecutor",
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/sauce.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/sauce.py
@@ -12,20 +12,20 @@ import time
 
 import requests
 
 from six.moves import cStringIO as StringIO
 
 from .base import Browser, ExecutorBrowser, require_arg
 from .base import get_timeout_multiplier   # noqa: F401
 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]
+here = os.path.dirname(__file__)
 # Number of seconds to wait between polling operations when detecting status of
 # Sauce Connect sub-process.
 sc_poll_period = 1
 
 
 __wptrunner__ = {"product": "sauce",
                  "check_args": "check_args",
                  "browser": "SauceBrowser",
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servo.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servo.py
@@ -3,17 +3,17 @@ import os
 from .base import NullBrowser, ExecutorBrowser, require_arg
 from .base import get_timeout_multiplier   # noqa: F401
 from ..executors import executor_kwargs as base_executor_kwargs
 from ..executors.executorservo import (ServoCrashtestExecutor,  # noqa: F401
                                        ServoTestharnessExecutor,  # noqa: F401
                                        ServoRefTestExecutor,  # noqa: F401
                                        ServoWdspecExecutor)  # noqa: F401
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 __wptrunner__ = {
     "product": "servo",
     "check_args": "check_args",
     "browser": "ServoBrowser",
     "executor": {
         "crashtest": "ServoCrashtestExecutor",
         "testharness": "ServoTestharnessExecutor",
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/servodriver.py
@@ -8,17 +8,17 @@ from tools.serve.serve import make_hosts
 
 from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
 from .base import get_timeout_multiplier   # noqa: F401
 from ..executors import executor_kwargs as base_executor_kwargs
 from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor,  # noqa: F401
                                              ServoWebDriverRefTestExecutor)  # noqa: F401
 from ..process import cast_env
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 __wptrunner__ = {
     "product": "servodriver",
     "check_args": "check_args",
     "browser": "ServoWebDriverBrowser",
     "executor": {
         "testharness": "ServoWebDriverTestharnessExecutor",
         "reftest": "ServoWebDriverRefTestExecutor",
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/config.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/config.py
@@ -1,30 +1,30 @@
 from six.moves.configparser import SafeConfigParser
 import os
 import sys
 from collections import OrderedDict
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 
 class ConfigDict(dict):
     def __init__(self, base_path, *args, **kwargs):
         self.base_path = base_path
         dict.__init__(self, *args, **kwargs)
 
     def get_path(self, key, default=None):
         if key not in self:
             return default
         path = self[key]
         os.path.expanduser(path)
         return os.path.abspath(os.path.join(self.base_path, path))
 
 def read(config_path):
     config_path = os.path.abspath(config_path)
-    config_root = os.path.split(config_path)[0]
+    config_root = os.path.dirname(config_path)
     parser = SafeConfigParser()
     success = parser.read(config_path)
     assert config_path in success, success
 
     subns = {"pwd": os.path.abspath(os.path.curdir)}
 
     rv = OrderedDict()
     for section in parser.sections():
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/environment.py
@@ -6,17 +6,17 @@ import socket
 import sys
 import time
 from six import iteritems
 
 from mozlog import get_default_logger, handlers, proxy
 
 from .wptlogging import LogLevelRewriter
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 repo_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir, os.pardir))
 
 sys.path.insert(0, repo_root)
 from tools import localpaths  # noqa: F401
 
 from wptserve.handlers import StringHandler
 
 serve = None
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py
@@ -11,17 +11,17 @@ from abc import ABCMeta, abstractmethod
 from six import text_type
 from six.moves.http_client import HTTPConnection
 from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit
 
 from ..testrunner import Stop
 from .actions import actions
 from .protocol import Protocol, BaseProtocolPart
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 
 
 def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
                     **kwargs):
     timeout_multiplier = kwargs["timeout_multiplier"]
     if timeout_multiplier is None:
         timeout_multiplier = 1
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorchrome.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorchrome.py
@@ -3,17 +3,17 @@ import traceback
 
 from six.moves.urllib.parse import urljoin
 
 from .base import WdspecProtocol, WdspecExecutor, get_pages
 from .executorwebdriver import WebDriverProtocol, WebDriverRefTestExecutor, WebDriverRun
 from .protocol import PrintProtocolPart
 from ..webdriver_server import ChromeDriverServer
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 
 class ChromeDriverPrintProtocolPart(PrintProtocolPart):
     def setup(self):
         self.webdriver = self.parent.webdriver
         self.runner_handle = None
 
     def load_runner(self):
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py
@@ -7,17 +7,17 @@ import uuid
 
 from six import iteritems, iterkeys
 from six.moves.urllib.parse import urljoin
 
 errors = None
 marionette = None
 pytestrunner = None
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 from .base import (CallbackHandler,
                    CrashtestExecutor,
                    RefTestExecutor,
                    RefTestImplementation,
                    TestharnessExecutor,
                    TimedRunner,
                    WdspecExecutor,
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorselenium.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorselenium.py
@@ -19,17 +19,17 @@ from .protocol import (BaseProtocolPart,
                        Protocol,
                        SelectorProtocolPart,
                        ClickProtocolPart,
                        SendKeysProtocolPart,
                        ActionSequenceProtocolPart,
                        TestDriverProtocolPart)
 from ..testrunner import Stop
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 webdriver = None
 exceptions = None
 RemoteConnection = None
 Command = None
 
 
 def do_delayed_imports():
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py
@@ -11,17 +11,17 @@ from .base import (Protocol,
                    TimedRunner,
                    strip_server)
 from ..testrunner import Stop
 from ..webdriver_server import wait_for_service
 
 webdriver = None
 ServoCommandExtensions = None
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 
 def do_delayed_imports():
     global webdriver
     import webdriver
 
     global ServoCommandExtensions
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executorwebdriver.py
@@ -26,17 +26,17 @@ from .protocol import (BaseProtocolPart,
                        GenerateTestReportProtocolPart,
                        SetPermissionProtocolPart,
                        VirtualAuthenticatorProtocolPart)
 from ..testrunner import Stop
 
 import webdriver as client
 from webdriver import error
 
-here = os.path.join(os.path.split(__file__)[0])
+here = os.path.dirname(__file__)
 
 
 class WebDriverCallbackHandler(CallbackHandler):
     unimplemented_exc = (NotImplementedError, client.UnknownCommandException)
 
 
 class WebDriverBaseProtocolPart(BaseProtocolPart):
     def setup(self):
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/font.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/font.py
@@ -1,17 +1,17 @@
 import ctypes
 import os
 import platform
 import plistlib
 
 from shutil import copy2, rmtree
 from subprocess import call, check_output
 
-HERE = os.path.split(__file__)[0]
+HERE = os.path.dirname(__file__)
 SYSTEM = platform.system().lower()
 
 
 class FontInstaller(object):
     def __init__(self, logger, font_dir=None, **fonts):
         self.logger = logger
         self.font_dir = font_dir
         self.installed_fonts = False
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/metadata.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/metadata.py
@@ -315,17 +315,17 @@ def directory_manifests(metadata_path):
 
 def write_new_expected(metadata_path, expected):
     # Serialize the data back to a file
     path = expected_path(metadata_path, expected.test_path)
     if not expected.is_empty:
         manifest_str = wptmanifest.serialize(expected.node,
                                              skip_empty_data=True)
         assert manifest_str != ""
-        dir = os.path.split(path)[0]
+        dir = os.path.dirname(path)
         if not os.path.exists(dir):
             os.makedirs(dir)
         tmp_path = path + ".tmp"
         try:
             with open(tmp_path, "wb") as f:
                 f.write(manifest_str.encode("utf8"))
             if sys.version_info >= (3, 3):
                 os.replace(tmp_path, path)
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/tests/__init__.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/tests/__init__.py
@@ -1,7 +1,7 @@
 import os
 import sys
 
-here = os.path.abspath(os.path.split(__file__)[0])
+here = os.path.abspath(os.path.dirname(__file__))
 sys.path.insert(0, os.path.join(here, os.pardir, os.pardir, os.pardir))
 
 import localpaths as _localpaths  # noqa: F401
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/state.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/state.py
@@ -1,12 +1,12 @@
 import os
 from six.moves import cPickle as pickle  # noqa: N813
 
-here = os.path.abspath(os.path.split(__file__)[0])
+here = os.path.abspath(os.path.dirname(__file__))
 
 class BaseState(object):
     def __new__(cls, logger):
         rv = cls.load(logger)
         if rv is not None:
             logger.debug("Existing state found")
             return rv
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/update/sync.py
@@ -3,17 +3,17 @@ import os
 import re
 import shutil
 import sys
 import uuid
 
 from .base import Step, StepRunner
 from .tree import Commit
 
-here = os.path.abspath(os.path.split(__file__)[0])
+here = os.path.abspath(os.path.dirname(__file__))
 
 
 def copy_wpt_tree(tree, dest, excludes=None, includes=None):
     """Copy the working copy of a Tree to a destination directory.
 
     :param tree: The Tree to copy.
     :param dest: The destination directory"""
     if os.path.exists(dest):
@@ -36,26 +36,26 @@ def copy_wpt_tree(tree, dest, excludes=N
     for tree_path in tree.paths():
         if (any(item.match(tree_path) for item in excludes) and
             not any(item.match(tree_path) for item in includes)):
             continue
 
         source_path = os.path.join(tree.root, tree_path)
         dest_path = os.path.join(dest, tree_path)
 
-        dest_dir = os.path.split(dest_path)[0]
+        dest_dir = os.path.dirname(dest_path)
         if not os.path.isdir(source_path):
             if not os.path.exists(dest_dir):
                 os.makedirs(dest_dir)
             shutil.copy2(source_path, dest_path)
 
     for source, destination in [("testharness_runner.html", ""),
                                 ("testdriver-vendor.js", "resources/")]:
         source_path = os.path.join(here, os.pardir, source)
-        dest_path = os.path.join(dest, destination, os.path.split(source)[1])
+        dest_path = os.path.join(dest, destination, os.path.basename(source))
         shutil.copy2(source_path, dest_path)
 
 
 class UpdateCheckout(Step):
     """Pull changes from upstream into the local sync tree."""
 
     provides = ["local_branch"]
 
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wptrunner.py
@@ -14,17 +14,17 @@ from . import testloader
 from . import wptcommandline
 from . import wptlogging
 from . import wpttest
 from mozlog import capture, handlers
 from .font import FontInstaller
 from .testrunner import ManagerGroup
 from .browsers.base import NullBrowser
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 
 logger = None
 
 """Runner for web-platform-tests
 
 The runner has several design goals:
 
 * Tests should run with no modification from upstream.
--- a/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
+++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/wpttest.py
@@ -130,17 +130,17 @@ class RunInfo(dict):
         import mozinfo
 
         path = metadata_root
         dirs = set()
         while path != os.path.expanduser('~'):
             if path in dirs:
                 break
             dirs.add(str(path))
-            path = os.path.split(path)[0]
+            path = os.path.dirname(path)
 
         mozinfo.find_and_update_from_json(*dirs)
 
 
 def server_protocol(manifest_item):
     if hasattr(manifest_item, "h2") and manifest_item.h2:
         return "h2"
     if hasattr(manifest_item, "https") and manifest_item.https:
--- a/testing/web-platform/tests/tools/wptserve/tests/functional/base.py
+++ b/testing/web-platform/tests/tools/wptserve/tests/functional/base.py
@@ -16,17 +16,17 @@ import ssl
 from localpaths import repo_root
 
 wptserve = pytest.importorskip("wptserve")
 
 logging.basicConfig()
 
 wptserve.logger.set_logger(logging.getLogger())
 
-here = os.path.split(__file__)[0]
+here = os.path.dirname(__file__)
 doc_root = os.path.join(here, "docroot")
 
 
 class Request(BaseRequest):
     def __init__(self, *args, **kwargs):
         BaseRequest.__init__(self, *args, **kwargs)
         self.method = "GET"
 
--- a/testing/web-platform/tests/tools/wptserve/wptserve/handlers.py
+++ b/testing/web-platform/tests/tools/wptserve/wptserve/handlers.py
@@ -192,17 +192,17 @@ class FileHandler(object):
             response.content = data
             response = wrap_pipeline(path, request, response)
             return response
 
         except (OSError, IOError):
             raise HTTPException(404)
 
     def get_headers(self, request, path):
-        rv = (self.load_headers(request, os.path.join(os.path.split(path)[0], "__dir__")) +
+        rv = (self.load_headers(request, os.path.join(os.path.dirname(path), "__dir__")) +
               self.load_headers(request, path))
 
         if not any(key.lower() == b"content-type" for (key, _) in rv):
             rv.insert(0, (b"Content-Type", guess_content_type(path).encode("ascii")))
 
         return rv
 
     def load_headers(self, request, path):
--- a/testing/web-platform/tests/xhr/resources/auth1/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth1/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth10/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth10/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth11/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth11/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth2/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth2/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth3/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth3/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth4/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth4/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)
--- a/testing/web-platform/tests/xhr/resources/auth9/auth.py
+++ b/testing/web-platform/tests/xhr/resources/auth9/auth.py
@@ -1,12 +1,12 @@
 import imp
 import os
 
 from wptserve.utils import isomorphic_decode
 
-here = os.path.split(os.path.abspath(isomorphic_decode(__file__)))[0]
+here = os.path.dirname(os.path.abspath(isomorphic_decode(__file__)))
 
 def main(request, response):
     auth = imp.load_source(u"", os.path.join(here,
                                              u"..",
                                              u"authentication.py"))
     return auth.main(request, response)