Skip to content

Commit

Permalink
Adjust code to use results_for_tests()
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaarreell committed Sep 18, 2024
1 parent be35e18 commit 75086fb
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions tmt/steps/report/reportportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,29 +512,10 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None:
self.verbose("uuid", suite_uuid, "yellow", shift=1)
self.data.suite_uuid = suite_uuid

# prepare data for test reporting
# report_queue is a list[tuple(serial_number, result)]
report_queue: list[tuple[int, Optional[Result]]] = []
tests_executed: set[int] = set()
# collect results per serial_number and populate queue of serial_numbers to report
result: Optional[Result] = None # hint for mypy
for result in self.step.plan.execute.results():
tests_executed.add(result.serial_number)
report_queue.append((result.serial_number, result))
# now extend the queue with tests that were not executed
# and populate tests_db
tests_db: dict[int, Test] = {}
test: Optional[Test] = None # hint for mypy
for test in self.step.plan.discover.tests():
tests_db[test.serial_number] = test
if test.serial_number not in tests_executed:
report_queue.append((test.serial_number, None))

# now we can proceed with the actual reporting, we report each serial_number and result
for (serial_number, result) in report_queue:
for result, test in self.step.plan.execute.results_for_tests(self.step.plan.discover.tests()):
test_time = self.time()
test = tests_db.get(serial_number)
test_name = None
serial_number = result.serial_number if result else test.serial_number

# TODO: for happz, connect Test to Result if possible
# (but now it is probably too hackish to be fixed)
Expand Down

0 comments on commit 75086fb

Please sign in to comment.