Skip to content

Commit 4fd479a

Browse files
committed
Use the new "type" labels after GH migration.
Closes python/core-workflow#432
1 parent 3d532cd commit 4fd479a

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

bedevere/prtype.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44

55
from . import util
66

7-
LABEL_PREFIX = "type"
7+
TYPE_LABEL_PREFIX = "type"
88

99

1010
@enum.unique
1111
class Category(enum.Enum):
1212
"""Category of Pull Request."""
13-
bugfix = f"{LABEL_PREFIX}-bugfix"
14-
documentation = f"{LABEL_PREFIX}-documentation"
15-
enhancement = f"{LABEL_PREFIX}-enhancement"
16-
performance = f"{LABEL_PREFIX}-performance"
17-
security = f"{LABEL_PREFIX}-security"
18-
tests = f"{LABEL_PREFIX}-tests"
13+
14+
type_bug = f"{TYPE_LABEL_PREFIX}-bug"
15+
documentation = "docs"
16+
type_feature = f"{TYPE_LABEL_PREFIX}-feature"
17+
performance = "performance"
18+
type_security = f"{TYPE_LABEL_PREFIX}-security"
19+
tests = "tests"
1920

2021

2122
async def add_category(gh, issue, category):

tests/test_filepaths.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from bedevere import filepaths
66

7+
from bedevere.prtype import Category
8+
79

810
class FakeGH:
911

@@ -82,7 +84,7 @@ async def test_docs_only():
8284
assert gh.post_url[0] == 'https://api.github.com/some/status'
8385
assert gh.post_data[0]['state'] == 'failure'
8486
assert gh.post_url[1] == 'https://api.github.com/some/label'
85-
assert gh.post_data[1] == ['type-documentation']
87+
assert gh.post_data[1] == [Category.documentation.value]
8688

8789

8890
async def test_tests_only():
@@ -109,7 +111,7 @@ async def test_tests_only():
109111
assert gh.post_url[0] == 'https://api.github.com/some/status'
110112
assert gh.post_data[0]['state'] == 'failure'
111113
assert gh.post_url[1] == 'https://api.github.com/some/label'
112-
assert gh.post_data[1] == ['type-tests']
114+
assert gh.post_data[1] == [Category.tests.value]
113115

114116

115117
async def test_docs_and_tests():
@@ -137,7 +139,7 @@ async def test_docs_and_tests():
137139
assert gh.post_url[0] == 'https://api.github.com/some/status'
138140
assert gh.post_data[0]['state'] == 'success'
139141
assert gh.post_url[1] == 'https://api.github.com/some/label'
140-
assert gh.post_data[1] == ['type-tests']
142+
assert gh.post_data[1] == [Category.tests.value]
141143

142144

143145
async def test_news_and_tests():
@@ -166,7 +168,7 @@ async def test_news_and_tests():
166168
assert gh.post_url[0] == 'https://api.github.com/some/status'
167169
assert gh.post_data[0]['state'] == 'success'
168170
assert gh.post_url[1] == 'https://api.github.com/some/label'
169-
assert gh.post_data[1] == ['type-tests']
171+
assert gh.post_data[1] == [Category.tests.value]
170172

171173

172174
async def test_synchronize():

tests/test_prtype.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from bedevere import prtype
2+
from bedevere.prtype import Category
23

34

45
class FakeGH:
@@ -84,7 +85,7 @@ async def test_docs_no_news():
8485
assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234'
8586
assert len(gh.post_url) == 1
8687
assert gh.post_url[0] == 'https://api.github.com/some/label'
87-
assert gh.post_data[0] == ['type-documentation']
88+
assert gh.post_data[0] == [Category.documentation.value]
8889

8990

9091
async def test_docs_and_news():
@@ -105,7 +106,7 @@ async def test_docs_and_news():
105106
assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234'
106107
assert len(gh.post_url) == 1
107108
assert gh.post_url[0] == 'https://api.github.com/some/label'
108-
assert gh.post_data[0] == ['type-documentation']
109+
assert gh.post_data[0] == [Category.documentation.value]
109110

110111

111112
async def test_tests_only():
@@ -126,7 +127,7 @@ async def test_tests_only():
126127
assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234'
127128
assert len(gh.post_url) == 1
128129
assert gh.post_url[0] == 'https://api.github.com/some/label'
129-
assert gh.post_data[0] == ['type-tests']
130+
assert gh.post_data[0] == [Category.tests.value]
130131

131132

132133
async def test_docs_and_tests():
@@ -148,7 +149,7 @@ async def test_docs_and_tests():
148149
# Only creates type-tests label.
149150
assert len(gh.post_url) == 1
150151
assert gh.post_url[0] == 'https://api.github.com/some/label'
151-
assert gh.post_data[0] == ['type-tests']
152+
assert gh.post_data[0] == [Category.tests.value]
152153

153154

154155
async def test_leave_existing_type_labels():
@@ -190,7 +191,7 @@ async def test_news_and_tests():
190191
# Creates type-tests label.
191192
assert len(gh.post_url) == 1
192193
assert gh.post_url[0] == 'https://api.github.com/some/label'
193-
assert gh.post_data[0] == ['type-tests']
194+
assert gh.post_data[0] == [Category.tests.value]
194195

195196

196197
async def test_other_files():

0 commit comments

Comments
 (0)