Skip to content

Commit fe7a62f

Browse files
committed
Use new sketches report key names
The breaking change to the report required to provide data for all sketches offered the opportunity to update key names without any potential for additional disruption. "sketch" was changed to "sketches" and "fqbn" was changed to "board".
1 parent 348b3d9 commit fe7a62f

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

reportsizedeltas.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class ReportSizeDeltas:
5757

5858
class ReportKeys:
5959
"""Key names used in the sketches report dictionary"""
60-
fqbn = "fqbn"
60+
board = "board"
6161
commit_hash = "commit_hash"
6262
commit_url = "commit_url"
6363
sizes = "sizes"
@@ -68,7 +68,7 @@ class ReportKeys:
6868
delta = "delta"
6969
minimum = "minimum"
7070
maximum = "maximum"
71-
sketch = "sketch"
71+
sketches = "sketches"
7272
compilation_success = "compilation_success"
7373

7474
def __init__(self, repository_name, artifact_name, token):
@@ -254,7 +254,7 @@ def get_sketches_reports(self, artifact_folder_object):
254254
# Combine sketches reports into an array
255255
with open(file=artifact_folder + "/" + report_filename) as report_file:
256256
report_data = json.load(report_file)
257-
if type(report_data[self.ReportKeys.sketch]) is not list:
257+
if self.ReportKeys.sketches not in report_data:
258258
# Sketches reports use the old format, skip
259259
print("Old format sketches report found, skipping")
260260
continue
@@ -282,7 +282,7 @@ def generate_report(self, sketches_reports):
282282
for row_number, fqbn_data in enumerate(iterable=sketches_reports, start=1):
283283
# Add a row to the report
284284
row = ["" for _ in range(len(summary_report_data[0]))]
285-
row[0] = fqbn_data[self.ReportKeys.fqbn]
285+
row[0] = fqbn_data[self.ReportKeys.board]
286286
summary_report_data.append(row)
287287

288288
# Populate the row with data
@@ -303,11 +303,11 @@ def generate_report(self, sketches_reports):
303303
for row_number, fqbn_data in enumerate(iterable=sketches_reports, start=1):
304304
# Add a row to the report
305305
row = ["" for _ in range(len(full_report_data[0]))]
306-
row[0] = fqbn_data[self.ReportKeys.fqbn]
306+
row[0] = fqbn_data[self.ReportKeys.board]
307307
full_report_data.append(row)
308308

309309
# Populate the row with data
310-
for sketch in fqbn_data[self.ReportKeys.sketch]:
310+
for sketch in fqbn_data[self.ReportKeys.sketches]:
311311
for size_data in sketch[self.ReportKeys.sizes]:
312312
# Determine column number for this memory type
313313
column_number = get_report_column_number(

tests/data/size-deltas-reports-new/arduino-avr-leonardo.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"fqbn": "arduino:avr:leonardo",
2+
"board": "arduino:avr:leonardo",
33
"commit_hash": "d8fd302",
44
"commit_url": "https://example.com/foo",
5-
"sketch": [
5+
"sketches": [
66
{
77
"name": "examples/Bar",
88
"compilation_success": true,

tests/data/size-deltas-reports-new/arduino-avr-uno.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"fqbn": "arduino:avr:uno",
2+
"board": "arduino:avr:uno",
33
"commit_hash": "d8fd302",
44
"commit_url": "https://example.com/foo",
5-
"sketch": [
5+
"sketches": [
66
{
77
"name": "examples/Bar",
88
"compilation_success": true,

tests/test_reportsizedeltas.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def test_get_artifact(tmp_path, test_artifact_name, expected_success):
379379
{
380380
report_keys.commit_hash: "d8fd302",
381381
report_keys.commit_url: "https://example.com/foo",
382-
report_keys.fqbn: "arduino:avr:leonardo",
382+
report_keys.board: "arduino:avr:leonardo",
383383
report_keys.sizes: [
384384
{
385385
report_keys.delta: {
@@ -400,7 +400,7 @@ def test_get_artifact(tmp_path, test_artifact_name, expected_success):
400400
report_keys.name: "RAM for global variables"
401401
}
402402
],
403-
report_keys.sketch: [
403+
report_keys.sketches: [
404404
{
405405
report_keys.compilation_success: True,
406406
report_keys.name: "examples/Bar",
@@ -466,7 +466,7 @@ def test_get_artifact(tmp_path, test_artifact_name, expected_success):
466466
{
467467
report_keys.commit_hash: "d8fd302",
468468
report_keys.commit_url: "https://example.com/foo",
469-
report_keys.fqbn: "arduino:avr:uno",
469+
report_keys.board: "arduino:avr:uno",
470470
report_keys.sizes: [
471471
{
472472
report_keys.delta: {
@@ -487,7 +487,7 @@ def test_get_artifact(tmp_path, test_artifact_name, expected_success):
487487
report_keys.name: "RAM for global variables"
488488
}
489489
],
490-
report_keys.sketch: [
490+
report_keys.sketches: [
491491
{
492492
report_keys.compilation_success: True,
493493
report_keys.name: "examples/Bar",

0 commit comments

Comments
 (0)