mirror of
https://github.com/servo/servo.git
synced 2025-08-30 01:28:21 +01:00
Update web-platform-tests to revision c583bcd7eb30f38cb2d673031cde245776f1da5a
This commit is contained in:
parent
ba1ed11ced
commit
bd791500b2
107 changed files with 2870 additions and 469 deletions
|
@ -1,32 +0,0 @@
|
|||
environment:
|
||||
global:
|
||||
HYPOTHESIS_PROFILE: ci
|
||||
matrix:
|
||||
- PYTHON: 'C:\\Python27'
|
||||
- PYTHON: 'C:\\Python35'
|
||||
- PYTHON: 'C:\\Python36'
|
||||
|
||||
# Needed to make py.test believe our top level can be imported (we
|
||||
# otherwise end up in a wpt-tools directory, and of course you cannot
|
||||
# import a name including a hyphen in Python, so it ignores the fact
|
||||
# we have a __init__.py at the top level).
|
||||
clone_folder: 'C:\projects\wpttools'
|
||||
|
||||
init:
|
||||
- 'git config --global core.autocrlf true'
|
||||
|
||||
install:
|
||||
- 'rm .git\index'
|
||||
- 'git reset --hard'
|
||||
- 'SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%'
|
||||
- 'git submodule update --init --recursive'
|
||||
- 'python.exe -m pip install tox codecov'
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- 'tox -e py'
|
||||
|
||||
on_success:
|
||||
- 'coverage combine'
|
||||
- 'codecov'
|
|
@ -18,4 +18,10 @@ select = E,W,F,N
|
|||
# N801: class names should use CapWords convention
|
||||
# N802: function name should be lowercase
|
||||
ignore = E128,E129,E221,E226,E231,E251,E265,E302,E303,E305,E402,E731,E901,W601,N801,N802
|
||||
exclude =
|
||||
.tox,
|
||||
pywebsocket,
|
||||
third_party,
|
||||
wptserve/docs/conf.py,
|
||||
wptserve/tests/functional/docroot/invalid.py
|
||||
max-line-length = 141
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
flake8==3.5.0
|
||||
pycodestyle==2.3.1
|
||||
pyflakes==1.6.0
|
||||
pep8-naming==0.4.1
|
|
@ -1,26 +1,20 @@
|
|||
[tox]
|
||||
envlist = py27,py36,pypy
|
||||
envlist = py27,py36,pypy,py27-flake8
|
||||
skipsdist=True
|
||||
|
||||
[testenv]
|
||||
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
|
||||
deps =
|
||||
flake8==3.5.0
|
||||
pycodestyle==2.3.1
|
||||
pyflakes==1.6.0
|
||||
pep8-naming==0.4.1
|
||||
pytest
|
||||
pytest-cov
|
||||
mock
|
||||
hypothesis
|
||||
pytest-catchlog
|
||||
|
||||
commands =
|
||||
pytest --cov {posargs}
|
||||
flake8 --append-config=flake8.ini
|
||||
commands = pytest --cov {posargs}
|
||||
|
||||
passenv =
|
||||
HYPOTHESIS_PROFILE
|
||||
|
||||
[flake8]
|
||||
exclude = .tox,html5lib,third_party,pywebsocket,six,_venv,webencodings,wptserve/docs,wptserve/tests/functional/docroot/,wpt,wptrunner
|
||||
[testenv:py27-flake8]
|
||||
deps = -r{toxinidir}/requirements_flake8.txt
|
||||
commands = flake8 --append-config={toxinidir}/flake8.ini {posargs}
|
||||
|
|
|
@ -46,7 +46,7 @@ class Browser(object):
|
|||
return NotImplemented
|
||||
|
||||
@abstractmethod
|
||||
def version(self, binary=None):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
"""Retrieve the release version of the installed browser."""
|
||||
return NotImplemented
|
||||
|
||||
|
@ -367,7 +367,7 @@ class Firefox(Browser):
|
|||
|
||||
return path
|
||||
|
||||
def version(self, binary=None):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
"""Retrieve the release version of the installed browser."""
|
||||
version_string = call(binary, "--version").strip()
|
||||
m = re.match(r"Mozilla Firefox (.*)", version_string)
|
||||
|
@ -394,7 +394,7 @@ class Fennec(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary=None):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
||||
|
||||
|
@ -458,7 +458,7 @@ class Chrome(Browser):
|
|||
os.chmod(path, st.st_mode | stat.S_IEXEC)
|
||||
return path
|
||||
|
||||
def version(self, binary=None):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
binary = binary or self.binary
|
||||
if uname[0] != "Windows":
|
||||
try:
|
||||
|
@ -497,7 +497,7 @@ class ChromeAndroid(Browser):
|
|||
chrome = Chrome()
|
||||
return chrome.install_webdriver(dest, channel)
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
||||
class Opera(Browser):
|
||||
|
@ -562,7 +562,7 @@ class Opera(Browser):
|
|||
os.chmod(path, st.st_mode | stat.S_IEXEC)
|
||||
return path
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
"""Retrieve the release version of the installed browser."""
|
||||
binary = binary or self.binary
|
||||
try:
|
||||
|
@ -593,7 +593,7 @@ class Edge(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
||||
|
||||
|
@ -619,7 +619,7 @@ class InternetExplorer(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
||||
|
||||
|
@ -647,8 +647,24 @@ class Safari(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
return None
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
if webdriver_binary is None:
|
||||
logger.warn("Cannot find Safari version without safaridriver")
|
||||
return None
|
||||
# Use `safaridriver --version` to get the version. Example output:
|
||||
# "Included with Safari 12.1 (14607.1.11)"
|
||||
# "Included with Safari Technology Preview (Release 67, 13607.1.9.0.1)"
|
||||
# The `--version` flag was added in STP 67, so allow the call to fail.
|
||||
try:
|
||||
version_string = call(webdriver_binary, "--version").strip()
|
||||
except subprocess.CalledProcessError:
|
||||
logger.warn("Failed to call %s --version", webdriver_binary)
|
||||
return None
|
||||
m = re.match(r"Included with Safari (.*)", version_string)
|
||||
if not m:
|
||||
logger.warn("Failed to extract version from: s%", version_string)
|
||||
return None
|
||||
return m.group(1)
|
||||
|
||||
|
||||
class SafariWebDriver(Safari):
|
||||
|
@ -707,7 +723,7 @@ class Servo(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
"""Retrieve the release version of the installed browser."""
|
||||
output = call(binary, "--version")
|
||||
m = re.search(r"Servo ([0-9\.]+-[a-f0-9]+)?(-dirty)?$", output.strip())
|
||||
|
@ -737,7 +753,7 @@ class Sauce(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
||||
|
||||
|
@ -759,5 +775,5 @@ class WebKit(Browser):
|
|||
def install_webdriver(self, dest=None, channel=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def version(self, binary):
|
||||
def version(self, binary=None, webdriver_binary=None):
|
||||
return None
|
||||
|
|
|
@ -509,7 +509,8 @@ def setup_wptrunner(venv, prompt=True, install_browser=False, **kwargs):
|
|||
|
||||
venv.install_requirements(os.path.join(wptrunner_path, "requirements.txt"))
|
||||
|
||||
kwargs['browser_version'] = setup_cls.browser.version(kwargs.get("binary"))
|
||||
kwargs['browser_version'] = setup_cls.browser.version(binary=kwargs.get("binary"),
|
||||
webdriver_binary=kwargs.get("webdriver_binary"))
|
||||
return kwargs
|
||||
|
||||
|
||||
|
|
32
tests/wpt/web-platform-tests/tools/wpt/tests/test_browser.py
Normal file
32
tests/wpt/web-platform-tests/tools/wpt/tests/test_browser.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import mock
|
||||
import subprocess
|
||||
|
||||
from tools.wpt import browser
|
||||
|
||||
@mock.patch('subprocess.check_output')
|
||||
def test_safari_version(mocked_check_output):
|
||||
safari = browser.Safari()
|
||||
|
||||
# Safari
|
||||
mocked_check_output.return_value = 'Included with Safari 12.1 (14607.1.11)'
|
||||
assert safari.version(webdriver_binary="safaridriver") == '12.1 (14607.1.11)'
|
||||
|
||||
# Safari Technology Preview
|
||||
mocked_check_output.return_value = 'Included with Safari Technology Preview (Release 67, 13607.1.9.0.1)'
|
||||
assert safari.version(webdriver_binary="safaridriver") == 'Technology Preview (Release 67, 13607.1.9.0.1)'
|
||||
|
||||
@mock.patch('subprocess.check_output')
|
||||
def test_safari_version_errors(mocked_check_output):
|
||||
safari = browser.Safari()
|
||||
|
||||
# No webdriver_binary
|
||||
assert safari.version() is None
|
||||
|
||||
# `safaridriver --version` return gibberish
|
||||
mocked_check_output.return_value = 'gibberish'
|
||||
assert safari.version(webdriver_binary="safaridriver") is None
|
||||
|
||||
# `safaridriver --version` fails (as it does for Safari <=12.0)
|
||||
mocked_check_output.return_value = 'dummy'
|
||||
mocked_check_output.side_effect = subprocess.CalledProcessError(1, 'cmd')
|
||||
assert safari.version(webdriver_binary="safaridriver") is None
|
|
@ -57,9 +57,9 @@ def test_setup_wptrunner(venv, product):
|
|||
parser = run.create_parser()
|
||||
kwargs = vars(parser.parse_args(["--channel=nightly", product]))
|
||||
kwargs["prompt"] = False
|
||||
kwargs["webdriver_binary"] = "fake"
|
||||
# Hack to get a real existing path
|
||||
kwargs["binary"] = sys.argv[0]
|
||||
kwargs["webdriver_binary"] = sys.argv[0]
|
||||
if kwargs["product"] == "sauce":
|
||||
kwargs["product"] = "sauce:firefox:63"
|
||||
run.setup_wptrunner(venv, **kwargs)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py27,py27-flake8
|
||||
envlist = py27
|
||||
skipsdist=True
|
||||
|
||||
[testenv]
|
||||
|
@ -14,14 +14,3 @@ deps =
|
|||
|
||||
commands =
|
||||
pytest --cov {posargs}
|
||||
|
||||
[testenv:py27-flake8]
|
||||
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
|
||||
deps =
|
||||
flake8==3.5.0
|
||||
pycodestyle==2.3.1
|
||||
pyflakes==1.6.0
|
||||
pep8-naming==0.4.1
|
||||
|
||||
commands =
|
||||
flake8 --append-config=../flake8.ini {posargs}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
xfail_strict=true
|
||||
|
||||
[tox]
|
||||
envlist = {py27}-{base,chrome,edge,firefox,ie,opera,safari,sauce,servo},py27-flake8
|
||||
envlist = py27-{base,chrome,edge,firefox,ie,opera,safari,sauce,servo}
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
|
@ -23,14 +23,3 @@ deps =
|
|||
commands = pytest {posargs:--cov}
|
||||
|
||||
setenv = CURRENT_TOX_ENV = {envname}
|
||||
|
||||
[testenv:py27-flake8]
|
||||
# flake8 versions should be kept in sync across tools/tox.ini, tools/wpt/tox.ini, and tools/wptrunner/tox.ini
|
||||
deps =
|
||||
flake8==3.5.0
|
||||
pycodestyle==2.3.1
|
||||
pyflakes==1.6.0
|
||||
pep8-naming==0.4.1
|
||||
|
||||
commands =
|
||||
flake8 --append-config=../flake8.ini
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue