@@ -1194,6 +1194,7 @@ def test_abstract_changelogs_write_changelog(patches):
11941194def test_abstract_changelogs_write_current (iters , patches , entries_layout ):
11951195 changelogs = DummyChangelogs ("PROJECT" )
11961196 patched = patches (
1197+ "AChangelogs._write_current_placeholder" ,
11971198 ("AChangelogs.entries_layout" ,
11981199 dict (new_callable = PropertyMock )),
11991200 ("AChangelogs.current_dir_path" ,
@@ -1208,7 +1209,9 @@ def test_abstract_changelogs_write_current(iters, patches, entries_layout):
12081209 sections = iters (dict , cb = lambda x : (f"K{ x } " , MagicMock ()), count = 10 )
12091210 sections ["changes" ] = MagicMock ()
12101211
1211- with patched as (m_entries , m_dir_path , m_path , m_tpl , m_sections ):
1212+ with patched as patchy :
1213+ (m_placeholder , m_entries ,
1214+ m_dir_path , m_path , m_tpl , m_sections ) = patchy
12121215 m_entries .return_value = entries_layout
12131216 m_sections .return_value .items .return_value = sections .items ()
12141217 assert not changelogs .write_current ()
@@ -1217,6 +1220,9 @@ def test_abstract_changelogs_write_current(iters, patches, entries_layout):
12171220 assert (
12181221 m_dir_path .return_value .mkdir .call_args
12191222 == [(), dict (parents = True , exist_ok = True )])
1223+ assert (
1224+ m_placeholder .call_args
1225+ == [(), {}])
12201226 assert not m_path .return_value .write_text .called
12211227 assert not m_dir_path .return_value .__truediv__ .called
12221228 assert not m_tpl .called
@@ -1237,6 +1243,7 @@ def test_abstract_changelogs_write_current(iters, patches, entries_layout):
12371243 assert (
12381244 m_tpl .return_value .render .return_value .lstrip .call_args
12391245 == [(), {}])
1246+ assert not m_placeholder .called
12401247 for k , v in sections .items ():
12411248 if k == "changes" :
12421249 assert not v .get .called
@@ -1246,6 +1253,26 @@ def test_abstract_changelogs_write_current(iters, patches, entries_layout):
12461253 == [("description" , ), {}])
12471254
12481255
1256+ def test_abstract_changelogs__write_current_placeholder (patches ):
1257+ changelogs = DummyChangelogs ("PROJECT" )
1258+ patched = patches (
1259+ ("AChangelogs.current_dir_path" ,
1260+ dict (new_callable = PropertyMock )),
1261+ prefix = "envoy.base.utils.abstract.project.changelog" )
1262+
1263+ with patched as (m_dir_path , ):
1264+ assert not changelogs ._write_current_placeholder ()
1265+
1266+ assert (
1267+ m_dir_path .return_value .joinpath .call_args
1268+ == [(
1269+ abstract .project .changelog .CHANGELOG_CURRENT_PLACEHOLDER , ),
1270+ {}])
1271+ assert (
1272+ m_dir_path .return_value .joinpath .return_value .write_text .call_args
1273+ == [("" , ), {}])
1274+
1275+
12491276@pytest .mark .parametrize ("entries_layout" , [True , False ])
12501277@pytest .mark .parametrize ("pending" , [True , False ])
12511278async def test_abstract_changelogs_write_date (
@@ -1347,6 +1374,7 @@ def test_abstract_changelogs_write_version(patches, exists, entries_layout):
13471374 changelogs = DummyChangelogs ("PROJECT" )
13481375 patched = patches (
13491376 "shutil" ,
1377+ "AChangelogs._write_current_placeholder" ,
13501378 ("AChangelogs.entries_layout" ,
13511379 dict (new_callable = PropertyMock )),
13521380 ("AChangelogs.changelog_class" ,
@@ -1362,8 +1390,9 @@ def test_abstract_changelogs_write_version(patches, exists, entries_layout):
13621390 prefix = "envoy.base.utils.abstract.project.changelog" )
13631391 version = MagicMock ()
13641392
1365- with patched as (m_shutil , m_entries , m_clogclass , m_dir_path ,
1366- m_datestamp , m_path , m_clog_path , m_dump ):
1393+ with patched as (
1394+ m_shutil , m_placeholder , m_entries , m_clogclass , m_dir_path ,
1395+ m_datestamp , m_path , m_clog_path , m_dump ):
13671396 m_entries .return_value = entries_layout
13681397 m_clog_path .return_value .exists .return_value = exists
13691398 entries_data = {}
@@ -1397,6 +1426,7 @@ def test_abstract_changelogs_write_version(patches, exists, entries_layout):
13971426 == [(m_clog_path .return_value , ), {}])
13981427 else :
13991428 assert not m_clogclass .return_value .get_data .called
1429+ assert not m_placeholder .called
14001430 return
14011431 if entries_layout :
14021432 assert (
@@ -1416,7 +1446,11 @@ def test_abstract_changelogs_write_version(patches, exists, entries_layout):
14161446 assert (
14171447 m_dir_path .return_value .mkdir .call_args
14181448 == [(), {}])
1449+ assert (
1450+ m_placeholder .call_args
1451+ == [(), {}])
14191452 else :
1453+ assert not m_placeholder .called
14201454 assert (
14211455 m_clog_path .return_value .write_text .call_args
14221456 == [(m_path .return_value .read_text .return_value , ), {}])
@@ -1431,6 +1465,7 @@ def test_abstract_changelogs_write_version_entries_layout_predated(patches):
14311465 changelogs = DummyChangelogs ("PROJECT" )
14321466 patched = patches (
14331467 "shutil" ,
1468+ "AChangelogs._write_current_placeholder" ,
14341469 ("AChangelogs.entries_layout" ,
14351470 dict (new_callable = PropertyMock )),
14361471 ("AChangelogs.changelog_class" ,
@@ -1443,8 +1478,9 @@ def test_abstract_changelogs_write_version_entries_layout_predated(patches):
14431478 prefix = "envoy.base.utils.abstract.project.changelog" )
14441479 version = MagicMock ()
14451480
1446- with patched as (m_shutil , m_entries , m_clogclass , m_dir_path ,
1447- m_path , m_clog_path ):
1481+ with patched as (
1482+ m_shutil , m_placeholder , m_entries , m_clogclass , m_dir_path ,
1483+ m_path , m_clog_path ):
14481484 m_entries .return_value = True
14491485 m_clog_path .return_value .exists .return_value = True
14501486 m_clogclass .return_value .get_data .return_value = {
@@ -1465,6 +1501,9 @@ def test_abstract_changelogs_write_version_entries_layout_predated(patches):
14651501 assert (
14661502 m_dir_path .return_value .mkdir .call_args
14671503 == [(), {}])
1504+ assert (
1505+ m_placeholder .call_args
1506+ == [(), {}])
14681507
14691508
14701509def test_abstract_changelogs_write_version_entries_parse_error (patches ):
@@ -1949,6 +1988,7 @@ async def execute(func, *args):
19491988 == [{"area" : "jwt" , "change" : "Fixed jwt.\n " }])
19501989 assert changelogs .current_dir_path .exists ()
19511990 assert not list (changelogs .current_dir_path .rglob ("*.rst" ))
1991+ assert changelogs .current_dir_path .joinpath ("PLACEHOLDER" ).is_file ()
19521992
19531993
19541994async def test_abstract_changelog_release_flow_regression (tmp_path ):
@@ -2019,6 +2059,7 @@ async def execute(func, *args):
20192059 # current/ wiped
20202060 assert changelogs .current_dir_path .exists ()
20212061 assert not list (changelogs .current_dir_path .rglob ("*.rst" ))
2062+ assert changelogs .current_dir_path .joinpath ("PLACEHOLDER" ).is_file ()
20222063
20232064
20242065async def test_abstract_changelog_release_date (patches ):
0 commit comments