@@ -143,6 +143,22 @@ def test_bad_include_paths(path, err_match):
143143 ({'license' : {'fromage' : 2 }}, '[Uu]nrecognised' ),
144144 ({'license' : {'file' : 'LICENSE' , 'text' : 'xyz' }}, 'both' ),
145145 ({'license' : {}}, 'required' ),
146+ ({'license-files' : 1 }, r"\blist\b" ),
147+ ({'license-files' : ["/LICENSE" ]}, r"'/LICENSE'.+must not start with '/'" ),
148+ ({'license-files' : ["../LICENSE" ]}, r"'../LICENSE'.+must not contain '..'" ),
149+ ({'license-files' : ["NOT_FOUND" ]}, r"No files found.+'NOT_FOUND'" ),
150+ pytest .param (
151+ {'license-files' : ["**LICENSE" ]}, r"'\*\*LICENSE'.+Invalid pattern" ,
152+ marks = [pytest .mark .skipif (
153+ sys .version_info >= (3 , 13 ), reason = "Pattern is valid for 3.13+"
154+ )]
155+ ),
156+ pytest .param (
157+ {'license-files' : ["./" ]}, r"'./'.+Unacceptable pattern" ,
158+ marks = [pytest .mark .skipif (
159+ sys .version_info < (3 , 13 ), reason = "Pattern started to raise ValueError in 3.13"
160+ )]
161+ ),
146162 ({'keywords' : 'foo' }, 'list' ),
147163 ({'keywords' : ['foo' , 7 ]}, 'strings' ),
148164 ({'entry-points' : {'foo' : 'module1:main' }}, 'entry-point.*tables' ),
@@ -207,27 +223,3 @@ def test_pep621_license_files(value, files):
207223 assert info .metadata ['license_files' ] == files
208224 finally :
209225 os .chdir (dir )
210-
211-
212- @pytest .mark .parametrize (('proj_bad' , 'err_match' ), [
213- ({'license-files' : ["/LICENSE" ]}, r"'/LICENSE'.+must not start with '/'" ),
214- ({'license-files' : ["../LICENSE" ]}, r"'../LICENSE'.+must not contain '..'" ),
215- ({'license-files' : ["NOT_FOUND" ]}, r"No files found.+'NOT_FOUND'" ),
216- pytest .param (
217- {'license-files' : ["**LICENSE" ]}, r"'\*\*LICENSE'.+Invalid pattern" ,
218- marks = [pytest .mark .skipif (
219- sys .version_info >= (3 , 13 ), reason = "Pattern is valid for 3.13+"
220- )]
221- ),
222- pytest .param (
223- {'license-files' : ["./" ]}, r"'./'.+Unacceptable pattern" ,
224- marks = [pytest .mark .skipif (
225- sys .version_info < (3 , 13 ), reason = "Pattern started to raise ValueError in 3.13"
226- )]
227- ),
228- ])
229- def test_bad_pep621_license_files (proj_bad , err_match ):
230- proj = {'name' : 'module1' , 'version' : '1.0' , 'description' : 'x' }
231- proj .update (proj_bad )
232- with pytest .raises (config .ConfigError , match = err_match ):
233- config .read_pep621_metadata (proj , samples_dir / 'pep621' )
0 commit comments