Bug 1636442 [wpt PR 23477] - Pass logger explicitly in to Executors, a=testonly

Automatic update from web-platform-tests
Pass logger explicitly in to Executors This means that we are able to report errors which happen during setup

--

wpt-commits: 48b773a266795216e28ac6b8e55f300bb6ad2541
wpt-pr: 23477
This commit is contained in:
James Graham 2020-05-20 16:58:59 +00:00 коммит произвёл moz-wptsync-bot
Родитель ba166f9944
Коммит c5f61959a3
7 изменённых файлов: 33 добавлений и 31 удалений

Просмотреть файл

@ -216,8 +216,9 @@ class TestExecutor(object):
extra_timeout = 5 # seconds extra_timeout = 5 # seconds
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
debug_info=None, **kwargs): debug_info=None, **kwargs):
self.logger = logger
self.runner = None self.runner = None
self.browser = browser self.browser = browser
self.server_config = server_config self.server_config = server_config
@ -227,12 +228,6 @@ class TestExecutor(object):
"prefs": {}} "prefs": {}}
self.protocol = None # This must be set in subclasses self.protocol = None # This must be set in subclasses
@property
def logger(self):
"""StructuredLogger for this executor"""
if self.runner is not None:
return self.runner.logger
def setup(self, runner): def setup(self, runner):
"""Run steps needed before tests can be started e.g. connecting to """Run steps needed before tests can be started e.g. connecting to
browser instance browser instance
@ -318,9 +313,9 @@ class TestharnessExecutor(TestExecutor):
class RefTestExecutor(TestExecutor): class RefTestExecutor(TestExecutor):
convert_result = reftest_result_converter convert_result = reftest_result_converter
def __init__(self, browser, server_config, timeout_multiplier=1, screenshot_cache=None, def __init__(self, logger, browser, server_config, timeout_multiplier=1, screenshot_cache=None,
debug_info=None, **kwargs): debug_info=None, **kwargs):
TestExecutor.__init__(self, browser, server_config, TestExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
@ -504,11 +499,11 @@ class WdspecExecutor(TestExecutor):
convert_result = pytest_result_converter convert_result = pytest_result_converter
protocol_cls = None protocol_cls = None
def __init__(self, browser, server_config, webdriver_binary, def __init__(self, logger, browser, server_config, webdriver_binary,
webdriver_args, timeout_multiplier=1, capabilities=None, webdriver_args, timeout_multiplier=1, capabilities=None,
debug_info=None, **kwargs): debug_info=None, **kwargs):
self.do_delayed_imports() self.do_delayed_imports()
TestExecutor.__init__(self, browser, server_config, TestExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.webdriver_binary = webdriver_binary self.webdriver_binary = webdriver_binary

Просмотреть файл

@ -669,11 +669,11 @@ class ExecuteAsyncScriptRun(TimedRunner):
class MarionetteTestharnessExecutor(TestharnessExecutor): class MarionetteTestharnessExecutor(TestharnessExecutor):
supports_testdriver = True supports_testdriver = True
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
close_after_done=True, debug_info=None, capabilities=None, close_after_done=True, debug_info=None, capabilities=None,
debug=False, ccov=False, **kwargs): debug=False, ccov=False, **kwargs):
"""Marionette-based executor for testharness.js tests""" """Marionette-based executor for testharness.js tests"""
TestharnessExecutor.__init__(self, browser, server_config, TestharnessExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.protocol = MarionetteProtocol(self, self.protocol = MarionetteProtocol(self,
@ -765,13 +765,14 @@ class MarionetteTestharnessExecutor(TestharnessExecutor):
class MarionetteRefTestExecutor(RefTestExecutor): class MarionetteRefTestExecutor(RefTestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
screenshot_cache=None, close_after_done=True, screenshot_cache=None, close_after_done=True,
debug_info=None, reftest_internal=False, debug_info=None, reftest_internal=False,
reftest_screenshot="unexpected", ccov=False, reftest_screenshot="unexpected", ccov=False,
group_metadata=None, capabilities=None, debug=False, **kwargs): group_metadata=None, capabilities=None, debug=False, **kwargs):
"""Marionette-based executor for reftests""" """Marionette-based executor for reftests"""
RefTestExecutor.__init__(self, RefTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
screenshot_cache=screenshot_cache, screenshot_cache=screenshot_cache,
@ -949,11 +950,11 @@ class MarionetteWdspecExecutor(WdspecExecutor):
class MarionetteCrashtestExecutor(CrashtestExecutor): class MarionetteCrashtestExecutor(CrashtestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
debug_info=None, capabilities=None, debug=False, debug_info=None, capabilities=None, debug=False,
ccov=False, **kwargs): ccov=False, **kwargs):
"""Marionette-based executor for testharness.js tests""" """Marionette-based executor for testharness.js tests"""
CrashtestExecutor.__init__(self, browser, server_config, CrashtestExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.protocol = MarionetteProtocol(self, self.protocol = MarionetteProtocol(self,

Просмотреть файл

@ -271,11 +271,11 @@ class SeleniumRun(TimedRunner):
class SeleniumTestharnessExecutor(TestharnessExecutor): class SeleniumTestharnessExecutor(TestharnessExecutor):
supports_testdriver = True supports_testdriver = True
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
close_after_done=True, capabilities=None, debug_info=None, close_after_done=True, capabilities=None, debug_info=None,
supports_eager_pageload=True, **kwargs): supports_eager_pageload=True, **kwargs):
"""Selenium-based executor for testharness.js tests""" """Selenium-based executor for testharness.js tests"""
TestharnessExecutor.__init__(self, browser, server_config, TestharnessExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.protocol = SeleniumProtocol(self, browser, capabilities) self.protocol = SeleniumProtocol(self, browser, capabilities)
@ -356,11 +356,12 @@ if (location.href === "about:blank") {
class SeleniumRefTestExecutor(RefTestExecutor): class SeleniumRefTestExecutor(RefTestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
screenshot_cache=None, close_after_done=True, screenshot_cache=None, close_after_done=True,
debug_info=None, capabilities=None, **kwargs): debug_info=None, capabilities=None, **kwargs):
"""Selenium WebDriver-based executor for reftests""" """Selenium WebDriver-based executor for reftests"""
RefTestExecutor.__init__(self, RefTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
screenshot_cache=screenshot_cache, screenshot_cache=screenshot_cache,

Просмотреть файл

@ -67,9 +67,9 @@ def build_servo_command(test, test_url_func, browser, binary, pause_after_test,
class ServoTestharnessExecutor(ProcessTestExecutor): class ServoTestharnessExecutor(ProcessTestExecutor):
convert_result = testharness_result_converter convert_result = testharness_result_converter
def __init__(self, browser, server_config, timeout_multiplier=1, debug_info=None, def __init__(self, logger, browser, server_config, timeout_multiplier=1, debug_info=None,
pause_after_test=False, **kwargs): pause_after_test=False, **kwargs):
ProcessTestExecutor.__init__(self, browser, server_config, ProcessTestExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.pause_after_test = pause_after_test self.pause_after_test = pause_after_test
@ -184,10 +184,11 @@ class TempFilename(object):
class ServoRefTestExecutor(ProcessTestExecutor): class ServoRefTestExecutor(ProcessTestExecutor):
convert_result = reftest_result_converter convert_result = reftest_result_converter
def __init__(self, browser, server_config, binary=None, timeout_multiplier=1, def __init__(self, logger, browser, server_config, binary=None, timeout_multiplier=1,
screenshot_cache=None, debug_info=None, pause_after_test=False, screenshot_cache=None, debug_info=None, pause_after_test=False,
**kwargs): **kwargs):
ProcessTestExecutor.__init__(self, ProcessTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
@ -310,10 +311,11 @@ class ServoTimedRunner(TimedRunner):
class ServoCrashtestExecutor(ProcessTestExecutor): class ServoCrashtestExecutor(ProcessTestExecutor):
convert_result = crashtest_result_converter convert_result = crashtest_result_converter
def __init__(self, browser, server_config, binary=None, timeout_multiplier=1, def __init__(self, logger, browser, server_config, binary=None, timeout_multiplier=1,
screenshot_cache=None, debug_info=None, pause_after_test=False, screenshot_cache=None, debug_info=None, pause_after_test=False,
**kwargs): **kwargs):
ProcessTestExecutor.__init__(self, ProcessTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,

Просмотреть файл

@ -155,10 +155,10 @@ class ServoWebDriverRun(TimedRunner):
class ServoWebDriverTestharnessExecutor(TestharnessExecutor): class ServoWebDriverTestharnessExecutor(TestharnessExecutor):
supports_testdriver = True supports_testdriver = True
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
close_after_done=True, capabilities=None, debug_info=None, close_after_done=True, capabilities=None, debug_info=None,
**kwargs): **kwargs):
TestharnessExecutor.__init__(self, browser, server_config, timeout_multiplier=1, TestharnessExecutor.__init__(self, logger, browser, server_config, timeout_multiplier=1,
debug_info=None) debug_info=None)
self.protocol = ServoWebDriverProtocol(self, browser, capabilities=capabilities) self.protocol = ServoWebDriverProtocol(self, browser, capabilities=capabilities)
with open(os.path.join(here, "testharness_servodriver.js")) as f: with open(os.path.join(here, "testharness_servodriver.js")) as f:
@ -221,11 +221,12 @@ class TimeoutError(Exception):
class ServoWebDriverRefTestExecutor(RefTestExecutor): class ServoWebDriverRefTestExecutor(RefTestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
screenshot_cache=None, capabilities=None, debug_info=None, screenshot_cache=None, capabilities=None, debug_info=None,
**kwargs): **kwargs):
"""Selenium WebDriver-based executor for reftests""" """Selenium WebDriver-based executor for reftests"""
RefTestExecutor.__init__(self, RefTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
screenshot_cache=screenshot_cache, screenshot_cache=screenshot_cache,

Просмотреть файл

@ -350,11 +350,11 @@ class WebDriverRun(TimedRunner):
class WebDriverTestharnessExecutor(TestharnessExecutor): class WebDriverTestharnessExecutor(TestharnessExecutor):
supports_testdriver = True supports_testdriver = True
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
close_after_done=True, capabilities=None, debug_info=None, close_after_done=True, capabilities=None, debug_info=None,
supports_eager_pageload=True, **kwargs): supports_eager_pageload=True, **kwargs):
"""WebDriver-based executor for testharness.js tests""" """WebDriver-based executor for testharness.js tests"""
TestharnessExecutor.__init__(self, browser, server_config, TestharnessExecutor.__init__(self, logger, browser, server_config,
timeout_multiplier=timeout_multiplier, timeout_multiplier=timeout_multiplier,
debug_info=debug_info) debug_info=debug_info)
self.protocol = WebDriverProtocol(self, browser, capabilities) self.protocol = WebDriverProtocol(self, browser, capabilities)
@ -449,11 +449,12 @@ if (location.href === "about:blank") {
class WebDriverRefTestExecutor(RefTestExecutor): class WebDriverRefTestExecutor(RefTestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
screenshot_cache=None, close_after_done=True, screenshot_cache=None, close_after_done=True,
debug_info=None, capabilities=None, **kwargs): debug_info=None, capabilities=None, **kwargs):
"""WebDriver-based executor for reftests""" """WebDriver-based executor for reftests"""
RefTestExecutor.__init__(self, RefTestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
screenshot_cache=screenshot_cache, screenshot_cache=screenshot_cache,
@ -517,11 +518,12 @@ class WebDriverRefTestExecutor(RefTestExecutor):
class WebDriverCrashtestExecutor(CrashtestExecutor): class WebDriverCrashtestExecutor(CrashtestExecutor):
def __init__(self, browser, server_config, timeout_multiplier=1, def __init__(self, logger, browser, server_config, timeout_multiplier=1,
screenshot_cache=None, close_after_done=True, screenshot_cache=None, close_after_done=True,
debug_info=None, capabilities=None, **kwargs): debug_info=None, capabilities=None, **kwargs):
"""WebDriver-based executor for reftests""" """WebDriver-based executor for reftests"""
CrashtestExecutor.__init__(self, CrashtestExecutor.__init__(self,
logger,
browser, browser,
server_config, server_config,
screenshot_cache=screenshot_cache, screenshot_cache=screenshot_cache,

Просмотреть файл

@ -158,7 +158,7 @@ def start_runner(runner_command_queue, runner_result_queue,
with capture.CaptureIO(logger, capture_stdio): with capture.CaptureIO(logger, capture_stdio):
try: try:
browser = executor_browser_cls(**executor_browser_kwargs) browser = executor_browser_cls(**executor_browser_kwargs)
executor = executor_cls(browser, **executor_kwargs) executor = executor_cls(logger, browser, **executor_kwargs)
with TestRunner(logger, runner_command_queue, runner_result_queue, executor) as runner: with TestRunner(logger, runner_command_queue, runner_result_queue, executor) as runner:
try: try:
runner.run() runner.run()