File tree Expand file tree Collapse file tree 2 files changed +30
-10
lines changed Expand file tree Collapse file tree 2 files changed +30
-10
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,26 @@ def parse_changes(
8383 if ctx .dist is not None :
8484 name = ctx .dist .name
8585
86+ return _parse_changes (
87+ changes = changes ,
88+ version = ctx .version ,
89+ start_line = start_line ,
90+ head_line = head_line ,
91+ fix_issue_regex = fix_issue_regex ,
92+ fix_issue_repl = fix_issue_repl ,
93+ )
94+
95+
96+ def _parse_changes (
97+ * ,
98+ changes : str ,
99+ version : str ,
100+ start_line : str ,
101+ head_line : str ,
102+ fix_issue_regex : str ,
103+ fix_issue_repl : str ,
104+ name : Optional [str ],
105+ ) -> str :
86106 top , sep , msg = changes .partition (start_line )
87107 if not sep :
88108 raise ValueError (f"Cannot find TOWNCRIER start mark ({ start_line !r} )" )
@@ -102,8 +122,8 @@ def parse_changes(
102122 f"Cannot find TOWNCRIER version head mark ({ head_re .pattern !r} )"
103123 )
104124 found_version = match .group ("version" )
105- if ctx . version != found_version :
106- raise ValueError (f"Version check mismatch: { ctx . version } != { found_version } " )
125+ if version != found_version :
126+ raise ValueError (f"Version check mismatch: { version } != { found_version } " )
107127
108128 match2 = head_re .search (msg , match .end ())
109129 if match2 is not None :
Original file line number Diff line number Diff line change 66from get_releasenote import (
77 Context ,
88 DistInfo ,
9+ _parse_changes ,
910 analyze_dists ,
1011 check_fix_issue ,
1112 find_version ,
12- parse_changes ,
1313)
1414
1515
@@ -116,7 +116,7 @@ def test_find_version_not_found(ctx: Context) -> None:
116116
117117def test_parse_no_start_line () -> None :
118118 with pytest .raises (ValueError , match = "Cannot find TOWNCRIER start mark" ):
119- parse_changes (
119+ _parse_changes (
120120 changes = "text" ,
121121 version = "1.2.3" ,
122122 start_line = START_LINE ,
@@ -135,7 +135,7 @@ def test_parse_no_head_line() -> None:
135135 """
136136 )
137137 with pytest .raises (ValueError , match = "Cannot find TOWNCRIER version head mark" ):
138- parse_changes (
138+ _parse_changes (
139139 changes = CHANGES ,
140140 version = "1.2.3" ,
141141 start_line = START_LINE ,
@@ -157,7 +157,7 @@ def test_parse_version_mismatch() -> None:
157157 """
158158 )
159159 with pytest .raises (ValueError , match = "Version check mismatch" ):
160- parse_changes (
160+ _parse_changes (
161161 changes = CHANGES ,
162162 version = "1.2.3" ,
163163 start_line = START_LINE ,
@@ -186,7 +186,7 @@ def test_parse_single_changes() -> None:
186186
187187 """
188188 )
189- ret = parse_changes (
189+ ret = _parse_changes (
190190 changes = CHANGES ,
191191 version = "1.2.3" ,
192192 start_line = START_LINE ,
@@ -231,7 +231,7 @@ def test_parse_multi_changes() -> None:
231231 --------
232232 """
233233 )
234- ret = parse_changes (
234+ ret = _parse_changes (
235235 changes = CHANGES ,
236236 version = "1.2.3" ,
237237 start_line = START_LINE ,
@@ -266,7 +266,7 @@ def test_parse_fix_issues() -> None:
266266 - Feature 1 `#4603 <https://github.com/aio-libs/aiohttp/issues/4603>`_
267267 """
268268 )
269- ret = parse_changes (
269+ ret = _parse_changes (
270270 changes = CHANGES ,
271271 version = "1.2.3" ,
272272 start_line = START_LINE ,
@@ -302,7 +302,7 @@ def test_parse_with_name() -> None:
302302
303303 """
304304 )
305- ret = parse_changes (
305+ ret = _parse_changes (
306306 changes = CHANGES ,
307307 version = "1.2.3" ,
308308 start_line = START_LINE ,
You can’t perform that action at this time.
0 commit comments