Skip to content

Commit 271cdff

Browse files
authored
Merge pull request #61 from per1234/fix-integration-test
Update integration tests to reflect changes to Arduino Lint output and rules
2 parents 4ebcc60 + 185f381 commit 271cdff

File tree

6 files changed

+751
-914
lines changed

6 files changed

+751
-914
lines changed

Diff for: test/test_all.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ def check_logs(configuration, golden_logs_parent_path, logs_subpath):
148148
logs_subpath -- sub-path for both the actual and golden master logs
149149
"""
150150
logs = pathlib.Path(configuration["LogsFolder"], logs_subpath).read_text(encoding="utf-8")
151+
# The table package used to format Arduino Lint output fills out the full column width with trailing whitespace.
152+
# This might not match the golden master logs after the template substitution.
153+
logs = "\n".join([line.rstrip() for line in logs.splitlines()])
151154

152155
golden_logs_template = golden_logs_parent_path.joinpath(logs_subpath).read_text(encoding="utf-8")
156+
golden_logs_template = "\n".join([line.rstrip() for line in golden_logs_template.splitlines()])
153157
# Fill template with mutable content
154158
golden_logs = string.Template(template=golden_logs_template).substitute(
155159
git_clones_folder=configuration["GitClonesFolder"]
@@ -179,8 +183,11 @@ def check_db(configuration):
179183
# The checksum values in the db will be different on every run, so it's necessary to replace them with a
180184
# placeholder before comparing to the golden master
181185
release["Checksum"] = checksum_placeholder
186+
# The table package used to format Arduino Lint output fills out the full column width with trailing whitespace.
187+
# This might not match the golden master release's "Log" field after the template substitution.
188+
release["Log"] = "\n".join([line.rstrip() for line in release["Log"].splitlines()])
182189

183-
# Load golden index
190+
# Load golden db
184191
golden_db_template = test_data_path.joinpath("test_all", "golden", "db.json").read_text(encoding="utf-8")
185192
# Fill in mutable content
186193
golden_db_string = string.Template(template=golden_db_template).substitute(
@@ -189,6 +196,8 @@ def check_db(configuration):
189196
git_clones_folder=configuration["GitClonesFolder"],
190197
)
191198
golden_db = json.loads(golden_db_string)
199+
for release in golden_db["Releases"]:
200+
release["Log"] = "\n".join([line.rstrip() for line in release["Log"].splitlines()])
192201

193202
# Compare db against golden master
194203
# Order of entries in the db is arbitrary so a simply equality assertion is not possible

0 commit comments

Comments
 (0)