Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make `mach test-tidy --self-test` compatible with Python3 #25253

Merged
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -213,7 +213,7 @@ def linux_tidy_unit():
python3 ./mach build --dev --features layout-2020
python3 ./mach build --dev --libsimpleservo
python3 ./mach build --dev -p servo-gst-plugin
./mach test-tidy --no-progress --self-test
python3 ./mach test-tidy --no-progress --self-test
./etc/memory_reports_over_time.py --test
./etc/taskcluster/mock.py
@@ -447,16 +447,16 @@ def check_shell(file_name, lines):
if not file_name.endswith(".sh"):
raise StopIteration

shebang = b"#!/usr/bin/env bash"
required_options = {"set -o errexit", "set -o nounset", "set -o pipefail"}
shebang = "#!/usr/bin/env bash"
required_options = ["set -o errexit", "set -o nounset", "set -o pipefail"]

did_shebang_check = False

if not lines:
yield (0, 'script is an empty file')
return

if lines[0].rstrip() != shebang:
if lines[0].rstrip() != shebang.encode("utf-8"):
yield (1, 'script does not have shebang "{}"'.format(shebang))

for idx, line in enumerate(map(lambda line: line.decode("utf-8"), lines[1:])):
@@ -506,7 +506,7 @@ def check_manifest_dirs(config_file, print_text=True):
return

# Load configs from include.ini
with open(config_file) as content:
with open(config_file, "rb") as content:
conf_file = content.read()
lines = conf_file.splitlines(True)

@@ -808,7 +808,7 @@ def check_yaml(file_name, contents):
line = e.problem_mark.line + 1 if hasattr(e, 'problem_mark') else None
yield (line, e)
except KeyError as e:
yield (None, "Duplicated Key ({})".format(e.message))
yield (None, "Duplicated Key ({})".format(e.args[0]))
except voluptuous.MultipleInvalid as e:
yield (None, str(e))

@@ -844,11 +844,11 @@ def check_json(filename, contents):
try:
json.loads(contents, object_pairs_hook=check_json_requirements(filename))
except ValueError as e:
match = re.search(r"line (\d+) ", e.message)
match = re.search(r"line (\d+) ", e.args[0])
line_no = match and match.group(1)
yield (line_no, e.message)
yield (line_no, e.args[0])
except KeyError as e:
yield (None, e.message)
yield (None, e.args[0])


def check_spec(file_name, lines):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.