bin/gen_release_notes: Add basic tests for parsing issues
Since test coverage here is pretty important for a heuristic like this. Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12201>
This commit is contained in:
@@ -182,9 +182,7 @@ async def gather_commits(version: str) -> str:
|
||||
return out.decode().strip()
|
||||
|
||||
|
||||
async def gather_bugs(version: str) -> typing.List[str]:
|
||||
commits = await gather_commits(version)
|
||||
|
||||
async def parse_issues(commits: str) -> typing.List[str]:
|
||||
issues: typing.List[str] = []
|
||||
for commit in commits.split('\n'):
|
||||
sha, message = commit.split(maxsplit=1)
|
||||
@@ -193,6 +191,7 @@ async def gather_bugs(version: str) -> typing.List[str]:
|
||||
stdout=asyncio.subprocess.PIPE)
|
||||
_out, _ = await p.communicate()
|
||||
out = _out.decode().split('\n')
|
||||
|
||||
for line in reversed(out):
|
||||
if line.startswith('Closes:'):
|
||||
bug = line.lstrip('Closes:').strip()
|
||||
@@ -205,6 +204,13 @@ async def gather_bugs(version: str) -> typing.List[str]:
|
||||
else:
|
||||
issues.append(bug.lstrip('#'))
|
||||
|
||||
return issues
|
||||
|
||||
|
||||
async def gather_bugs(version: str) -> typing.List[str]:
|
||||
commits = await gather_commits(version)
|
||||
issues = await parse_issues(commits)
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
async with aiohttp.ClientSession(loop=loop) as session:
|
||||
results = await asyncio.gather(*[get_bug(session, i) for i in issues])
|
||||
|
Reference in New Issue
Block a user