@@ -130,7 +130,6 @@ def tearDown(self):
130130
131131 def test_det_pr_title (self ):
132132 """Test det_pr_title function"""
133- # check if patches for extensions are found
134133 rawtxt = textwrap .dedent ("""
135134 easyblock = 'ConfigureMake'
136135 name = '%s'
@@ -1007,9 +1006,8 @@ def test_github_det_patch_specs(self):
10071006 file_info ['ecs' ].append (EasyConfig (None , rawtxt = rawtxt ))
10081007
10091008 error_pattern = "Failed to determine software name to which patch file .*/2.patch relates"
1010- self .mock_stdout (True )
1011- self .assertErrorRegex (EasyBuildError , error_pattern , gh .det_patch_specs , patch_paths , file_info , [])
1012- self .mock_stdout (False )
1009+ with self .mocked_stdout ():
1010+ self .assertErrorRegex (EasyBuildError , error_pattern , gh .det_patch_specs , patch_paths , file_info , [])
10131011
10141012 rawtxt = textwrap .dedent ("""
10151013 easyblock = 'ConfigureMake'
@@ -1019,12 +1017,11 @@ def test_github_det_patch_specs(self):
10191017 description = ''
10201018 toolchain = {"name":"GCC", "version": "4.6.3"}
10211019
1022- patches = [('3.patch', 'subdir'), '2.patch']
1020+ postinstallpatches = [('3.patch', 'subdir'), '2.patch']
10231021 """ )
10241022 file_info ['ecs' ].append (EasyConfig (None , rawtxt = rawtxt ))
1025- self .mock_stdout (True )
1026- res = gh .det_patch_specs (patch_paths , file_info , [])
1027- self .mock_stdout (False )
1023+ with self .mocked_stdout ():
1024+ res = gh .det_patch_specs (patch_paths , file_info , [])
10281025
10291026 self .assertEqual ([i [0 ] for i in res ], patch_paths )
10301027 self .assertEqual ([i [1 ] for i in res ], ['A' , 'C' , 'C' ])
@@ -1043,20 +1040,24 @@ def test_github_det_patch_specs(self):
10431040 ('bar', '1.2.3'),
10441041 ('patched', '4.5.6', {
10451042 'patches': [('%(name)s-2.patch', 1), '%(name)s-3.patch'],
1043+ 'postinstallpatches': ['%(name)s-4.patch'],
10461044 }),
10471045 ]
1046+ postinstallpatches = ['%(name)s-5.patch'],
10481047 """ )
1049- patch_paths [1 :3 ] = [os .path .join (self .test_prefix , p ) for p in ['patched-2.patch' , 'patched-3.patch' ]]
1048+ patch_paths [1 :] = [os .path .join (self .test_prefix , p ) for p in
1049+ ['patched-2.patch' , 'patched-3.patch' , 'patched-4.patch' , 'patched_ext-5.patch' ]]
10501050 file_info ['ecs' ][- 1 ] = EasyConfig (None , rawtxt = rawtxt )
10511051
1052- self .mock_stdout (True )
1053- res = gh .det_patch_specs (patch_paths , file_info , [])
1054- self .mock_stdout (False )
1052+ with self .mocked_stdout ():
1053+ res = gh .det_patch_specs (patch_paths , file_info , [])
10551054
10561055 self .assertEqual ([i [0 ] for i in res ], patch_paths )
1057- self .assertEqual ([i [1 ] for i in res ], ['A' , 'patched_ext' , 'patched_ext' ])
1056+ self .assertEqual ([i [1 ] for i in res ], ['A' ] + [ 'patched_ext' ] * 4 )
10581057
10591058 # check if patches for components are found
1059+ # NOTE: Using alternative name and tuple format for post_install_patches, different to above test case
1060+ # to verify handling either way works without adding another sub-test
10601061 rawtxt = textwrap .dedent ("""
10611062 easyblock = 'PythonBundle'
10621063 name = 'patched_bundle'
@@ -1069,17 +1070,19 @@ def test_github_det_patch_specs(self):
10691070 ('bar', '1.2.3'),
10701071 ('patched', '4.5.6', {
10711072 'patches': [('%(name)s-2.patch', 1), '%(name)s-3.patch'],
1073+ 'post_install_patches': [('%(name)s-4.patch', 1)],
10721074 }),
10731075 ]
1076+ post_install_patches = [('%(name)s-5.patch', 2)]
10741077 """ )
1078+ patch_paths [- 1 ] = 'patched_bundle-5.patch'
10751079 file_info ['ecs' ][- 1 ] = EasyConfig (None , rawtxt = rawtxt )
10761080
1077- self .mock_stdout (True )
1078- res = gh .det_patch_specs (patch_paths , file_info , [])
1079- self .mock_stdout (False )
1081+ with self .mocked_stdout ():
1082+ res = gh .det_patch_specs (patch_paths , file_info , [])
10801083
10811084 self .assertEqual ([i [0 ] for i in res ], patch_paths )
1082- self .assertEqual ([i [1 ] for i in res ], ['A' , 'patched_bundle' , 'patched_bundle' ])
1085+ self .assertEqual ([i [1 ] for i in res ], ['A' ] + [ 'patched_bundle' ] * 4 )
10831086
10841087 def test_github_restclient (self ):
10851088 """Test use of RestClient."""
0 commit comments