Expand tidy to lint parts of /tests/wpt

This commit is contained in:
Corey Farwell 2015-11-03 17:11:44 -05:00
parent 1e3010e4cd
commit d1824aea48
8 changed files with 35 additions and 19 deletions

View file

@ -23,7 +23,10 @@ reftest_filetype = ".list"
ignored_files = [
# Upstream
os.path.join(".", "support", "*"),
os.path.join(".", "tests", "wpt", "*"),
os.path.join(".", "tests", "wpt", "css-tests", "*"),
os.path.join(".", "tests", "wpt", "harness", "*"),
os.path.join(".", "tests", "wpt", "update", "*"),
os.path.join(".", "tests", "wpt", "web-platform-tests", "*"),
os.path.join(".", "python", "mach", "*"),
os.path.join(".", "components", "script", "dom", "bindings", "codegen", "parser", "*"),
os.path.join(".", "components", "script", "dom", "bindings", "codegen", "ply", "*"),

View file

@ -4,10 +4,10 @@
from mozlog.formatters import base
import collections
import mozlog.commandline
import os
import sys
class GroupingFormatter(base.BaseFormatter):
"""Formatter designed to produce unexpected test results grouped
together in a readable format."""
@ -54,7 +54,7 @@ class GroupingFormatter(base.BaseFormatter):
output = self.text_to_erase_display()
if text:
output += text
if new_display != None:
if new_display is not None:
self.current_display = new_display
return output + self.current_display
@ -235,7 +235,7 @@ class GroupingFormatter(base.BaseFormatter):
# We are logging messages that begin with STDERR, because that is how exceptions
# in this formatter are indicated.
if data['message'].startswith('STDERR'):
return self.generate_output(text=data['message']+"\n")
return self.generate_output(text=data['message'] + "\n")
if data['level'] in ('CRITICAL', 'ERROR'):
return self.generate_output(text=data['message']+"\n")
return self.generate_output(text=data['message'] + "\n")

View file

@ -1,3 +1,8 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
def main(request, response):
output = '\x1b\x03)\x00\xa4\xcc\xde\xe2\xb3 vA\x00\x0c'
headers = [("Content-type", "text/plain"),

View file

@ -2,7 +2,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import multiprocessing
import os
import sys
@ -12,9 +11,11 @@ import grouping_formatter
here = os.path.split(__file__)[0]
servo_root = os.path.abspath(os.path.join(here, "..", ".."))
def wpt_path(*args):
return os.path.join(here, *args)
def servo_path(*args):
return os.path.join(servo_root, *args)
@ -22,6 +23,7 @@ def servo_path(*args):
sys.path.append(wpt_path("harness"))
from wptrunner import wptrunner, wptcommandline
def run_tests(paths=None, **kwargs):
if paths is None:
paths = {}
@ -34,6 +36,7 @@ def run_tests(paths=None, **kwargs):
success = wptrunner.run_tests(**kwargs)
return 0 if success else 1
def set_defaults(paths, kwargs):
if kwargs["product"] is None:
kwargs["product"] = "servo"
@ -57,6 +60,7 @@ def set_defaults(paths, kwargs):
wptcommandline.check_args(kwargs)
def main(paths=None):
parser = wptcommandline.create_parser()
kwargs = vars(parser.parse_args())

View file

@ -2,16 +2,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#!/usr/bin/env python
import run
import sys
paths = {"include_manifest": run.wpt_path("include_css.ini"),
"config": run.wpt_path("config_css.ini")}
def run_tests(**kwargs):
return run.run_tests(paths=paths, **kwargs)
def main():
return run.main(paths)

View file

@ -2,16 +2,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#!/usr/bin/env python
import run
import sys
paths = {"include_manifest": run.wpt_path("include.ini"),
"config": run.wpt_path("config.ini")}
def run_tests(**kwargs):
return run.run_tests(paths=paths, **kwargs)
def main():
return run.main(paths)

View file

@ -2,21 +2,20 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#!/usr/bin/env python
import argparse
import multiprocessing
import os
import sys
from wptrunner import wptcommandline
here = os.path.split(__file__)[0]
def wpt_path(*args):
return os.path.join(here, *args)
# Imports
from update import updatecommandline
def update_tests(**kwargs):
import update
@ -26,11 +25,13 @@ def update_tests(**kwargs):
rv = update.run_update(logger, **kwargs)
return 0 if rv is update.exit_unclean else 1
def set_defaults(kwargs):
if kwargs["config"] is None:
kwargs["config"] = wpt_path('config.ini')
updatecommandline.check_args(kwargs)
def main():
parser = wptcommandline.create_parser()
kwargs = vars(parser.parse_args())

View file

@ -2,14 +2,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#!/usr/bin/env python
import argparse
import os
import sys
here = os.path.split(__file__)[0]
def wpt_path(*args):
return os.path.join(here, *args)
@ -17,6 +15,7 @@ def wpt_path(*args):
sys.path.append(wpt_path("harness"))
from wptrunner import wptcommandline
def update_tests(**kwargs):
from wptrunner import update
@ -26,11 +25,13 @@ def update_tests(**kwargs):
rv = update.run_update(logger, **kwargs)
return 0 if rv is update.update.exit_clean else 1
def set_defaults(kwargs):
if kwargs["config"] is None:
kwargs["config"] = wpt_path('config_css.ini')
wptcommandline.set_from_config(kwargs)
def main():
parser = wptcommandline.create_parser_update()
kwargs = vars(parser.parse_args())