@@ -155,7 +155,8 @@ def nodes(*runs: 'tuple[str, str, list[tuple[str, ...]]]') -> 'list[dict[str, An
155155 ('NOTICE' , '' , 'The ubuntu-latest label will migrate to Ubuntu 26' )])
156156
157157#: A stand-in ``gh``: ``api graphql -f ...``, the check-suite query, answers
158- #: ``$FAKE_SUITE_ANSWER``; ``run download`` copies ``$FAKE_ARTIFACTS``' folders;
158+ #: ``$FAKE_SUITE_ANSWER``; ``run download`` copies ``$FAKE_ARTIFACTS``' folders,
159+ #: or, given ``say:TEXT``, fails printing ``TEXT``;
159160#: both log their arguments to ``$FAKE_SUITE_LOG``. ``api graphql --input -``, the
160161#: posting script's own calls, goes to the stand-in GitHub beside it.
161162FAKE_GH = textwrap .dedent ('''\
@@ -170,6 +171,9 @@ def nodes(*runs: 'tuple[str, str, list[tuple[str, ...]]]') -> 'list[dict[str, An
170171 if source == 'fail':
171172 print('HTTP 403: Resource not accessible by integration', file=sys.stderr)
172173 sys.exit(1)
174+ if source.startswith('say:'):
175+ print(source[4:], file=sys.stderr)
176+ sys.exit(1)
173177 if not source or not os.listdir(source):
174178 print('no valid artifacts found to download', file=sys.stderr)
175179 sys.exit(1)
@@ -729,6 +733,32 @@ def test_unreadable_summaries_warn(self) -> None:
729733 report )
730734 self .assertIn ('::warning title=CI report not written::The job summaries could not be read' , stdout )
731735
736+ def test_each_nothing_to_download_wording_is_no_summary (self ) -> None :
737+ # #2074: each way gh's pkg/cmd/run/download/download.go says it found nothing.
738+ for text in ('no valid artifacts found to download' ,
739+ 'no artifact matches any of the names or patterns provided' ,
740+ 'no artifact matches any of the names provided' ):
741+ with self .subTest (text = text ):
742+ outputs , report , stdout = self .report ('success' , check_runs (GREEN ), FAKE_ARTIFACTS = f'say:{ text } ' )
743+ self .assertEqual (outputs ['post' ], 'true' )
744+ self .assertNotIn ('Job summaries' , report )
745+ self .assertNotIn ('could not be read' , report )
746+ self .assertNotIn ('::warning' , stdout )
747+
748+ def test_a_genuine_download_error_still_warns (self ) -> None :
749+ # The last holds a wording inside a longer line, which is not gh saying it.
750+ for text in ('error fetching artifacts: HTTP 401: Bad credentials (https://api.github.com/repos/'
751+ 'JarryShaw/PyPCAPKit/actions/runs/1/artifacts?per_page=100)' ,
752+ 'error fetching artifacts: HTTP 404: Not Found (https://api.github.com/repos/'
753+ 'JarryShaw/PyPCAPKit/actions/runs/1/artifacts?per_page=100)' ,
754+ 'error fetching artifacts: Get "https://api.github.com/repos/JarryShaw/PyPCAPKit/actions/'
755+ 'runs/1/artifacts?per_page=100": dial tcp: lookup api.github.com: no such host' ,
756+ 'error downloading job-summary-test-0: unexpected EOF (not: no valid artifacts found to download)' ):
757+ with self .subTest (text = text ):
758+ _ , report , stdout = self .report ('success' , check_runs (GREEN ), FAKE_ARTIFACTS = f'say:{ text } ' )
759+ self .assertIn (f'The job summaries could not be read: `{ text } `.' , report )
760+ self .assertIn ('::warning title=CI report not written::The job summaries could not be read' , stdout )
761+
732762
733763class TestTheDownload (unittest .TestCase ):
734764 """:func:`check_suite_report.download` reads each artifact's folder, and one unpacked in place."""
0 commit comments