@@ -69,54 +69,50 @@ def test_substitution_branch(repo, template, real_template, branch, suffix):
6969 # leading zeros are removed by setuptools
7070 ("{tag}.post{env:PIPELINE_ID}" , "234" , "234" ),
7171 ("{tag}.post{env:PIPELINE_ID}" , "0234" , "234" ),
72- ("{tag}.post{env:PIPELINE_ID}" , None , "UNKNOWN" ),
7372 ("{tag}.post{env:PIPELINE_ID:123}" , "234" , "234" ),
7473 ("{tag}.post{env:PIPELINE_ID:123}" , None , "123" ),
7574 ("{tag}.post{env:PIPELINE_ID:IGNORE}" , "234" , "234" ),
7675 ("{tag}.post{env:PIPELINE_ID:IGNORE}" , None , "0" ),
7776 ("{tag}.post{env:PIPELINE_ID:}" , "234" , "234" ),
78- ("{tag}.post{env:PIPELINE_ID:}" , None , "UNKNOWN" ),
7977 ("{tag}.post{env:PIPELINE_ID:{ccount}}" , "234" , "234" ),
8078 ("{tag}.post{env:PIPELINE_ID:{ccount}}" , None , "1" ),
8179 ("{tag}.post{env:PIPELINE_ID:{timestamp:%Y}}" , "234" , "234" ),
8280 ("{tag}.post{env:PIPELINE_ID:{timestamp:%Y}}" , None , datetime .now ().year ),
8381 ("{tag}.post{env:PIPELINE_ID:{env:ANOTHER_ENV}}" , "234" , "234" ),
84- ("{tag}.post{env:PIPELINE_ID:{env:ANOTHER_ENV}}" , None , "3.4.5 " ),
82+ ("{tag}.post{env:PIPELINE_ID:{env:ANOTHER_ENV}}" , None , "345 " ),
8583 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV}}" , "234" , "234" ),
86- ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV}}" , None , "UNKNOWN" ),
8784 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:IGNORE}}" , "234" , "234" ),
8885 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:IGNORE}}" , None , "0" ),
8986 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:}}" , "234" , "234" ),
90- ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:}}" , None , "UNKNOWN" ),
91- ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:5.6.7}}" , "234" , "234" ),
92- ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:5.6.7}}" , None , "5.6.7" ),
87+ ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:567}}" , "234" , "234" ),
88+ ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:567}}" , None , "567" ),
9389 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:{ccount}}}" , "234" , "234" ),
9490 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:{ccount}}}" , None , "1" ),
9591 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:{timestamp:%Y}}}" , "234" , "234" ),
9692 ("{tag}.post{env:PIPELINE_ID:{env:MISSING_ENV:{timestamp:%Y}}}" , None , datetime .now ().year ),
97- ("{tag}.post{env:PIPELINE_ID}+abc{env:ANOTHER_ENV}" , "234" , "234+abc3.4.5 " ),
93+ ("{tag}.post{env:PIPELINE_ID}+abc{env:ANOTHER_ENV}" , "234" , "234+abc345 " ),
9894 ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV}" , "234" , "234+abcunknown" ),
9995 ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:5.6.7}" , "234" , "234+abc5.6.7" ),
100- ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:B-C% D}" , "234" , "234+abcb.c.d" ),
96+ ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:B-C- D}" , "234" , "234+abcb.c.d" ),
10197 ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:IGNORE}d" , "234" , "234+abcd" ),
10298 ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:}d" , "234" , "234+abcunknownd" ),
103- ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV: }d" , "234" , "234+abc.d" ),
99+ ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:. }d" , "234" , "234+abc.d" ),
104100 ("{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:{ccount}}" , "234" , "234+abc1" ),
105101 (
106102 "{tag}.post{env:PIPELINE_ID}+abc{env:MISSING_ENV:{timestamp:%Y}}" ,
107103 "234" ,
108104 "234+abc" + str (datetime .now ().year ),
109105 ),
110106 # empty env variable name
111- ("{tag}.post{env: } " , "234" , "UNKNOWN " ),
107+ ("{tag}.post{env:PIPELINE_ID}+abc{env: }d " , "234" , "234+abcunknownd " ),
112108 ],
113109)
114110def test_substitution_env (repo , dev_template , pipeline_id , suffix ):
115111 create_setup_py (repo , {"dev_template" : dev_template })
116112 create_tag (repo , "1.2.3" )
117113 create_file (repo )
118114
119- env = {"ANOTHER_ENV" : "3.4.5 " }
115+ env = {"ANOTHER_ENV" : "345 " }
120116 if pipeline_id is not None :
121117 env ["PIPELINE_ID" ] = pipeline_id
122118
@@ -139,8 +135,8 @@ def test_substitution_env(repo, dev_template, pipeline_id, suffix):
139135 "{tag}.post{ccount}+{}" ,
140136 lambda dt : (dt .strftime ("%Y.%m.%dt%H.%M" ),),
141137 ),
142- # unknown format
143- ("{tag}+git{timestamp:%i }" , "{tag}+git.i " , lambda x : []),
138+ # pure string
139+ ("{tag}+git. {timestamp:abc }" , "{tag}+git.abc " , lambda x : []),
144140 ],
145141)
146142def test_substitution_timestamp (repo , template , fmt , callback ):
@@ -155,6 +151,7 @@ def test_substitution_timestamp(repo, template, fmt, callback):
155151 if new_value == value :
156152 break
157153 value = new_value
154+
158155 assert new_value in get_version_setup_py (repo )
159156
160157
@@ -170,6 +167,7 @@ def test_substitution_timestamp(repo, template, fmt, callback):
170167 "{tag}+a{env:MISSING_ENV:{}}}" ,
171168 "{tag}+a{timestamp:A:B}" ,
172169 "{tag}+a{timestamp:{%Y}" ,
170+ "{tag}+a{timestamp:%i}" ,
173171 ],
174172)
175173def test_substitution_wrong_format (repo , template ):
0 commit comments