Skip to content

Commit

Permalink
Merge pull request #338 from espressif/fix/record-app_path-in-junit
Browse files Browse the repository at this point in the history
fix: record app_path in junit reports
  • Loading branch information
hfudev authored Jan 29, 2025
2 parents 88c955b + 8484ed6 commit 41bfcd9
Show file tree
Hide file tree
Showing 13 changed files with 464 additions and 270 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# ruff, ruff-format
3f0008207d272b7fa4329d86a157f4533f1a441f
a90b0d0c35a8e1c6896130e23c46cedee48b4158
9 changes: 6 additions & 3 deletions pytest-embedded-arduino/tests/test_arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ def test_arduino_app(app, dut):

result = testdir.runpytest(
'-s',
'--embedded-services', 'arduino,esp',
'--app-path', os.path.join(testdir.tmpdir, 'hello_world_arduino'),
'--build-dir', 'build',
'--embedded-services',
'arduino,esp',
'--app-path',
os.path.join(testdir.tmpdir, 'hello_world_arduino'),
'--build-dir',
'build',
)

result.assert_outcomes(passed=1)
11 changes: 7 additions & 4 deletions pytest-embedded-idf/pytest_embedded_idf/unity_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ def wrapper(self, *args, **kwargs):
finally:
_end_at = time.perf_counter()
self._add_single_unity_test_case(
_case, _log, additional_attrs={'time': round(_end_at - _start_at, 3)}
_case,
_log,
additional_attrs={'app_path': self.app.app_path, 'time': round(_end_at - _start_at, 3)},
)

return wrapper
Expand Down Expand Up @@ -695,6 +697,8 @@ def process_raw_report_data(self, raw_data_to_report) -> t.Dict:
if log:
attrs.update({'stdout': log})

attrs.update({'app_path': self.dut.app.app_path})

return attrs

def add_to_report(self, attrs):
Expand Down Expand Up @@ -765,9 +769,6 @@ def gather(self):
for _t in self.workers:
_t.close()

def get_processed_report_data(self, res: t.List[t.Any]) -> t.List[t.Dict]:
return [self.workers[i].process_raw_report_data(res[i]) for i in range(len(res))]

@staticmethod
def get_merge_data(test_cases_attr: t.List[t.Dict]) -> t.Dict:
output = {}
Expand All @@ -794,6 +795,8 @@ def get_merge_data(test_cases_attr: t.List[t.Dict]) -> t.Dict:
for k, val in output.items():
if k in ('file', 'line'):
output[k] = val[0]
elif k == 'app_path':
output[k] = '|'.join(val)
else:
output[k] = '<------------------->\n'.join(val)

Expand Down
Loading

0 comments on commit 41bfcd9

Please sign in to comment.