diff --git a/python/tidy.py b/python/tidy.py index b0c61dba333..44f7ba45b63 100644 --- a/python/tidy.py +++ b/python/tidy.py @@ -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", "*"), diff --git a/tests/wpt/grouping_formatter.py b/tests/wpt/grouping_formatter.py index 614c3c0ae37..467fad1c834 100644 --- a/tests/wpt/grouping_formatter.py +++ b/tests/wpt/grouping_formatter.py @@ -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.""" @@ -22,7 +22,7 @@ class GroupingFormatter(base.BaseFormatter): self.tests_with_failing_subtests = [] self.interactive = os.isatty(sys.stdout.fileno()) - self.expected = { + self.expected = { 'OK': 0, 'PASS': 0, 'FAIL': 0, @@ -32,7 +32,7 @@ class GroupingFormatter(base.BaseFormatter): 'CRASH': 0, } - self.unexpected_tests = { + self.unexpected_tests = { 'OK': [], 'PASS': [], 'FAIL': [], @@ -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") diff --git a/tests/wpt/mozilla/tests/mozilla/resources/brotli.py b/tests/wpt/mozilla/tests/mozilla/resources/brotli.py index 7e27b5c7d17..b6f0f9b2a57 100644 --- a/tests/wpt/mozilla/tests/mozilla/resources/brotli.py +++ b/tests/wpt/mozilla/tests/mozilla/resources/brotli.py @@ -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"), diff --git a/tests/wpt/run.py b/tests/wpt/run.py index ad11763d3e6..0ee62500f73 100644 --- a/tests/wpt/run.py +++ b/tests/wpt/run.py @@ -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()) diff --git a/tests/wpt/run_css.py b/tests/wpt/run_css.py index 08d4d80bbc5..d66c06f0f2a 100644 --- a/tests/wpt/run_css.py +++ b/tests/wpt/run_css.py @@ -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) diff --git a/tests/wpt/run_wpt.py b/tests/wpt/run_wpt.py index 86beee1d94e..676c5fb426d 100644 --- a/tests/wpt/run_wpt.py +++ b/tests/wpt/run_wpt.py @@ -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) diff --git a/tests/wpt/update.py b/tests/wpt/update.py index 311d8248e41..f77635e9b0a 100644 --- a/tests/wpt/update.py +++ b/tests/wpt/update.py @@ -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()) diff --git a/tests/wpt/update_css.py b/tests/wpt/update_css.py index 75fffd9cb4d..908d9581cb1 100644 --- a/tests/wpt/update_css.py +++ b/tests/wpt/update_css.py @@ -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())