Skip to content

Commit 0c5f97f

Browse files
gsneddersmoz-wptsync-bot
authored andcommitted
Bug 1671350 [wpt PR 26103] - Improve resources tests, a=testonly
Automatic update from web-platform-tests Add a --headless option to resources/test/ -- Use same Python interpreter for wpt server in resources/test/ -- wpt-commits: bbd1631075b74de45e5f165543d06de20f544f34, 99261220126ae61a7dd40e0eec9fb9a763ba774f wpt-pr: 26103
1 parent ca472df commit 0c5f97f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

testing/web-platform/tests/resources/test/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
def pytest_addoption(parser):
2727
parser.addoption("--binary", action="store", default=None, help="path to browser binary")
28+
parser.addoption("--headless", action="store_true", default=False, help="run browser in headless mode")
2829

2930

3031
def pytest_collect_file(path, parent):
@@ -45,9 +46,11 @@ def pytest_configure(config):
4546
config.proc = subprocess.Popen(["geckodriver"])
4647
config.add_cleanup(config.proc.kill)
4748

48-
capabilities = {"alwaysMatch": {"acceptInsecureCerts": True}}
49+
capabilities = {"alwaysMatch": {"acceptInsecureCerts": True, "moz:firefoxOptions": {}}}
4950
if config.getoption("--binary"):
50-
capabilities["alwaysMatch"]["moz:firefoxOptions"] = {"binary": config.getoption("--binary")}
51+
capabilities["alwaysMatch"]["moz:firefoxOptions"]["binary"] = config.getoption("--binary")
52+
if config.getoption("--headless"):
53+
capabilities["alwaysMatch"]["moz:firefoxOptions"]["args"] = ["--headless"]
5154

5255
config.driver = webdriver.Session("localhost", 4444,
5356
capabilities=capabilities)

testing/web-platform/tests/resources/test/wptserver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def __init__(self, wpt_root):
2424
def start(self):
2525
self.devnull = open(os.devnull, 'w')
2626
wptserve_cmd = [os.path.join(self.wpt_root, 'wpt'), 'serve']
27+
if sys.executable:
28+
wptserve_cmd[0:0] = [sys.executable]
2729
logging.info('Executing %s' % ' '.join(wptserve_cmd))
2830
self.proc = subprocess.Popen(
2931
wptserve_cmd,

0 commit comments

Comments
 (0)