From c2b193af3d190f807e554fb8bbdd58bfe9380ebc Mon Sep 17 00:00:00 2001 From: Stephen McGruer Date: Fri, 14 Aug 2020 15:53:03 -0400 Subject: [PATCH] Pass Text instead of full kwargs dict --- tools/ci/tc/github_checks_output.py | 12 ++++++------ tools/lint/lint.py | 2 +- tools/wptrunner/wptrunner/stability.py | 2 +- tools/wptrunner/wptrunner/wptcommandline.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/ci/tc/github_checks_output.py b/tools/ci/tc/github_checks_output.py index 4948fa567b3c4b..b541ffc5c8c7e3 100644 --- a/tools/ci/tc/github_checks_output.py +++ b/tools/ci/tc/github_checks_output.py @@ -27,14 +27,14 @@ def output(self, line): __outputter = None -def get_gh_checks_outputter(kwargs): - # type: (Dict[Text, Text]) -> Optional[GitHubChecksOutputter] +def get_gh_checks_outputter(filepath): + # type: (Optional[Text]) -> Optional[GitHubChecksOutputter] """Return the outputter for GitHub Checks output, if enabled. - :param kwargs: The arguments passed to the program (to look for the - github_checks_text_file field) + :param filepath: The filepath to write GitHub Check output information to, + or None if not enabled. """ global __outputter - if kwargs['github_checks_text_file'] and __outputter is None: - __outputter = GitHubChecksOutputter(kwargs['github_checks_text_file']) + if filepath and __outputter is None: + __outputter = GitHubChecksOutputter(filepath) return __outputter diff --git a/tools/lint/lint.py b/tools/lint/lint.py index 7eb20e6fb5f3a9..8965c1a0a12926 100644 --- a/tools/lint/lint.py +++ b/tools/lint/lint.py @@ -959,7 +959,7 @@ def main(**kwargs_str): ignore_glob = kwargs.get("ignore_glob", []) - github_checks_outputter = get_gh_checks_outputter(kwargs) + github_checks_outputter = get_gh_checks_outputter(kwargs["github_checks_text_file"]) return lint(repo_root, paths, output_format, ignore_glob, github_checks_outputter) diff --git a/tools/wptrunner/wptrunner/stability.py b/tools/wptrunner/wptrunner/stability.py index 605b40281a1b55..ee6cd974fdcad4 100644 --- a/tools/wptrunner/wptrunner/stability.py +++ b/tools/wptrunner/wptrunner/stability.py @@ -347,7 +347,7 @@ def check_stability(logger, repeat_loop=10, repeat_restart=5, chaos_mode=True, m start_time = datetime.now() step_results = [] - github_checks_outputter = get_gh_checks_outputter(kwargs) + github_checks_outputter = get_gh_checks_outputter(kwargs["github_checks_text_file"]) for desc, step_func in steps: if max_time and datetime.now() - start_time > max_time: diff --git a/tools/wptrunner/wptrunner/wptcommandline.py b/tools/wptrunner/wptrunner/wptcommandline.py index ea586825616132..532c795cd3c5f5 100644 --- a/tools/wptrunner/wptrunner/wptcommandline.py +++ b/tools/wptrunner/wptrunner/wptcommandline.py @@ -5,7 +5,7 @@ from collections import OrderedDict from distutils.spawn import find_executable from datetime import timedelta -from six import iterkeys, itervalues, iteritems +from six import ensure_text, iterkeys, itervalues, iteritems from . import config from . import wpttest @@ -350,7 +350,7 @@ def create_parser(product_choices=None): taskcluster_group = parser.add_argument_group("Taskcluster-specific") taskcluster_group.add_argument("--github-checks-text-file", - dest="github_checks_text_file", + type=ensure_text, help="Path to GitHub checks output file") webkit_group = parser.add_argument_group("WebKit-specific")