Skip to content

Update integration tests to reflect changes to Arduino Lint output and rules #61

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

Merged
merged 3 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion test/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ def check_logs(configuration, golden_logs_parent_path, logs_subpath):
logs_subpath -- sub-path for both the actual and golden master logs
"""
logs = pathlib.Path(configuration["LogsFolder"], logs_subpath).read_text(encoding="utf-8")
# The table package used to format Arduino Lint output fills out the full column width with trailing whitespace.
# This might not match the golden master logs after the template substitution.
logs = "\n".join([line.rstrip() for line in logs.splitlines()])

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

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

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