Skip to content

Commit

Permalink
Fixing issue when summary is None (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi authored Sep 30, 2021
1 parent 2596e3a commit a7a5990
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/publish/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def get_check_run_from_list(self, runs: List[CheckRun]) -> Optional[CheckRun]:
return runs[0]

# filter based on summary
runs = [run for run in runs if digest_prefix in run.output.summary]
runs = [run for run in runs if run.output.summary and digest_prefix in run.output.summary]
logger.debug(f'there are {len(runs)} check runs with a test result summary')
if len(runs) == 0:
return None
Expand Down
7 changes: 4 additions & 3 deletions python/test/test_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,14 +533,15 @@ def test_get_check_run_from_list_empty(self):
self.do_test_get_check_run_from_list([], None)

def test_get_check_run_from_list_many(self):
expected = self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='summary\n[test-results]:data:application/gzip;base64,digest')
runs = [
self.mock_check_run(name='Other title', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='summary\n[test-results]:data:application/gzip;base64,digest'),
self.mock_check_run(name='Check Name', status='other status', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='summary\n[test-results]:data:application/gzip;base64,digest'),
self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 0, 0, tzinfo=timezone.utc), summary='summary\n[test-results]:data:application/gzip;base64,digest'),
expected,
self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='no digest')
self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='summary\n[test-results]:data:application/gzip;base64,digest'),
self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary='no digest'),
self.mock_check_run(name='Check Name', status='completed', started_at=datetime(2021, 3, 19, 12, 2, 4, tzinfo=timezone.utc), summary=None)
]
expected = runs[3]
name = runs[0].name
self.do_test_get_check_run_from_list(runs, expected)

Expand Down

0 comments on commit a7a5990

Please sign in to comment.