mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
bin/gen_release_notes: Remove duplicate bug entires
A multiple commits may reference the same bug (for example, a commit is only a partial fix). We don't want that to show up in our fixed bug log. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38492>
This commit is contained in:
parent
cda114e0e4
commit
9d2c8e5b98
2 changed files with 23 additions and 1 deletions
|
|
@ -226,7 +226,8 @@ async def gather_bugs(version: str) -> typing.List[str]:
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
async with aiohttp.ClientSession(loop=loop) as session:
|
async with aiohttp.ClientSession(loop=loop) as session:
|
||||||
results = await asyncio.gather(*[get_bug(session, i) for i in issues])
|
results = await asyncio.gather(*[get_bug(session, i) for i in issues])
|
||||||
bugs = list(results)
|
# Remove duplicates.
|
||||||
|
bugs = sorted(set(results))
|
||||||
if not bugs:
|
if not bugs:
|
||||||
bugs = ['None']
|
bugs = ['None']
|
||||||
return bugs
|
return bugs
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,9 @@ import typing
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
import aiohttp
|
||||||
|
|
||||||
# AsyncMock is new in 3.8, so if we're using an older version we need the
|
# AsyncMock is new in 3.8, so if we're using an older version we need the
|
||||||
# backported version of mock
|
# backported version of mock
|
||||||
if sys.version_info >= (3, 8):
|
if sys.version_info >= (3, 8):
|
||||||
|
|
@ -199,7 +202,25 @@ async def test_parse_issues(content: str, bugs: typing.List[str]) -> None:
|
||||||
ids = await parse_issues('1234 not used')
|
ids = await parse_issues('1234 not used')
|
||||||
assert set(ids) == set(bugs)
|
assert set(ids) == set(bugs)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_rst_escape():
|
async def test_rst_escape():
|
||||||
out = inliner.quoteInline('foo@bar')
|
out = inliner.quoteInline('foo@bar')
|
||||||
assert out == 'foo\@bar'
|
assert out == 'foo\@bar'
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_gather_bugs_duplicates():
|
||||||
|
mock_gc = mock.AsyncMock(return_value='something')
|
||||||
|
mock_pi = mock.AsyncMock(return_value=['a', 'b', 'a', 'a', 'c', 'b'])
|
||||||
|
|
||||||
|
async def get_bug(session: 'aiohttp.ClientSession', bug_id: str) -> str:
|
||||||
|
return bug_id
|
||||||
|
|
||||||
|
with mock.patch('bin.gen_release_notes.gather_commits', mock_gc), \
|
||||||
|
mock.patch('bin.gen_release_notes.parse_issues', mock_pi), \
|
||||||
|
mock.patch('bin.gen_release_notes.get_bug', get_bug):
|
||||||
|
bugs = await gather_bugs('')
|
||||||
|
|
||||||
|
assert bugs == ['a', 'b', 'c']
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue