Skip to content
Permalink
Browse files

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

  • Loading branch information
marmeladema committed Dec 11, 2019
1 parent 3f663d7 commit 4fc5154dd1766fae5a2d10e8669906c9af7e4e90
Showing with 78 additions and 78 deletions.
  1. +1 −1 etc/taskcluster/decision_task.py
  2. +8 −8 python/tidy/servo_tidy/tidy.py
  3. +69 −69 python/tidy/servo_tidy_tests/test_tidy.py
@@ -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):

0 comments on commit 4fc5154

Please sign in to comment.
You can’t perform that action at this time.