From 48341f4dbf827dfb8394769ce1d1572456f18a4c Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 19 May 2021 19:25:37 +0000 Subject: [PATCH] Bug 1707876 - Remove browsers.base.inherit and remaining useage, r=whimboo This was designed to allow reusing configuration across browsers, but in practice it's only used once and is adding additional complexity that isn't merited by the amount of use. Differential Revision: https://phabricator.services.mozilla.com/D113670 --- .../wptrunner/wptrunner/browsers/base.py | 20 ------------- .../wptrunner/browsers/edge_webdriver.py | 30 ++++++++++++++----- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py index 81b9c0e80e4a4..4d307b7e20ce4 100644 --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/base.py @@ -3,32 +3,12 @@ import platform import socket from abc import ABCMeta, abstractmethod -from copy import deepcopy from ..wptcommandline import require_arg # noqa: F401 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 - - for k in ("check_args", "browser", "browser_kwargs", "executor_kwargs", - "env_extras", "env_options", "timeout_multiplier"): - attr = super_wptrunner[k] - child_globals[attr] = getattr(super_module, attr) - - for v in super_module.__wptrunner__["executor"].values(): - child_globals[v] = getattr(super_module, v) - - if "run_info_extras" in super_wptrunner: - attr = super_wptrunner["run_info_extras"] - child_globals[attr] = getattr(super_module, attr) - - def cmd_arg(name, value=None): prefix = "-" if platform.system() == "Windows" else "--" rv = prefix + name diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py index c2545de46f0b5..e5949fe3e57fb 100644 --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/browsers/edge_webdriver.py @@ -1,12 +1,28 @@ -from .base import inherit -from . import edge +from .base import NullBrowser # noqa: F401 +from .edge import (EdgeBrowser, # noqa: F401 + EdgeDriverWdspecExecutor, # noqa: F401 + check_args, # noqa: F401 + browser_kwargs, # noqa: F401 + executor_kwargs, # noqa: F401 + env_extras, # noqa: F401 + env_options, # noqa: F401 + run_info_extras, # noqa: F401 + get_timeout_multiplier) # noqa: F401 from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401 WebDriverRefTestExecutor) # noqa: F401 -inherit(edge, globals(), "edge_webdriver") - -# __wptrunner__ magically appears from inherit, F821 is undefined name -__wptrunner__["executor"]["testharness"] = "WebDriverTestharnessExecutor" # noqa: F821 -__wptrunner__["executor"]["reftest"] = "WebDriverRefTestExecutor" # noqa: F821 +__wptrunner__ = {"product": "edge_webdriver", + "check_args": "check_args", + "browser": {None: "EdgeBrowser", + "wdspec": "NullBrowser"}, + "executor": {"testharness": "WebDriverTestharnessExecutor", + "reftest": "WebDriverRefTestExecutor", + "wdspec": "EdgeDriverWdspecExecutor"}, + "browser_kwargs": "browser_kwargs", + "executor_kwargs": "executor_kwargs", + "env_extras": "env_extras", + "env_options": "env_options", + "run_info_extras": "run_info_extras", + "timeout_multiplier": "get_timeout_multiplier"}