@@ -120,7 +120,6 @@ def tearDown(self):
120120
121121 def test_det_pr_title (self ):
122122 """Test det_pr_title function"""
123- # check if patches for extensions are found
124123 rawtxt = textwrap .dedent ("""
125124 easyblock = 'ConfigureMake'
126125 name = '%s'
@@ -995,9 +994,8 @@ def test_github_det_patch_specs(self):
995994 file_info ['ecs' ].append (EasyConfig (None , rawtxt = rawtxt ))
996995
997996 error_pattern = "Failed to determine software name to which patch file .*/2.patch relates"
998- self .mock_stdout (True )
999- self .assertErrorRegex (EasyBuildError , error_pattern , gh .det_patch_specs , patch_paths , file_info , [])
1000- self .mock_stdout (False )
997+ with self .mocked_stdout ():
998+ self .assertErrorRegex (EasyBuildError , error_pattern , gh .det_patch_specs , patch_paths , file_info , [])
1001999
10021000 rawtxt = textwrap .dedent ("""
10031001 easyblock = 'ConfigureMake'
@@ -1007,12 +1005,11 @@ def test_github_det_patch_specs(self):
10071005 description = ''
10081006 toolchain = {"name":"GCC", "version": "4.6.3"}
10091007
1010- patches = [('3.patch', 'subdir'), '2.patch']
1008+ postinstallpatches = [('3.patch', 'subdir'), '2.patch']
10111009 """ )
10121010 file_info ['ecs' ].append (EasyConfig (None , rawtxt = rawtxt ))
1013- self .mock_stdout (True )
1014- res = gh .det_patch_specs (patch_paths , file_info , [])
1015- self .mock_stdout (False )
1011+ with self .mocked_stdout ():
1012+ res = gh .det_patch_specs (patch_paths , file_info , [])
10161013
10171014 self .assertEqual ([i [0 ] for i in res ], patch_paths )
10181015 self .assertEqual ([i [1 ] for i in res ], ['A' , 'C' , 'C' ])
@@ -1031,20 +1028,24 @@ def test_github_det_patch_specs(self):
10311028 ('bar', '1.2.3'),
10321029 ('patched', '4.5.6', {
10331030 'patches': [('%(name)s-2.patch', 1), '%(name)s-3.patch'],
1031+ 'postinstallpatches': ['%(name)s-4.patch'],
10341032 }),
10351033 ]
1034+ postinstallpatches = ['%(name)s-5.patch'],
10361035 """ )
1037- patch_paths [1 :3 ] = [os .path .join (self .test_prefix , p ) for p in ['patched-2.patch' , 'patched-3.patch' ]]
1036+ patch_paths [1 :] = [os .path .join (self .test_prefix , p ) for p in
1037+ ['patched-2.patch' , 'patched-3.patch' , 'patched-4.patch' , 'patched_ext-5.patch' ]]
10381038 file_info ['ecs' ][- 1 ] = EasyConfig (None , rawtxt = rawtxt )
10391039
1040- self .mock_stdout (True )
1041- res = gh .det_patch_specs (patch_paths , file_info , [])
1042- self .mock_stdout (False )
1040+ with self .mocked_stdout ():
1041+ res = gh .det_patch_specs (patch_paths , file_info , [])
10431042
10441043 self .assertEqual ([i [0 ] for i in res ], patch_paths )
1045- self .assertEqual ([i [1 ] for i in res ], ['A' , 'patched_ext' , 'patched_ext' ])
1044+ self .assertEqual ([i [1 ] for i in res ], ['A' ] + [ 'patched_ext' ] * 4 )
10461045
10471046 # check if patches for components are found
1047+ # NOTE: Using alternative name and tuple format for post_install_patches, different to above test case
1048+ # to verify handling either way works without adding another sub-test
10481049 rawtxt = textwrap .dedent ("""
10491050 easyblock = 'PythonBundle'
10501051 name = 'patched_bundle'
@@ -1057,17 +1058,19 @@ def test_github_det_patch_specs(self):
10571058 ('bar', '1.2.3'),
10581059 ('patched', '4.5.6', {
10591060 'patches': [('%(name)s-2.patch', 1), '%(name)s-3.patch'],
1061+ 'post_install_patches': [('%(name)s-4.patch', 1)],
10601062 }),
10611063 ]
1064+ post_install_patches = [('%(name)s-5.patch', 2)]
10621065 """ )
1066+ patch_paths [- 1 ] = 'patched_bundle-5.patch'
10631067 file_info ['ecs' ][- 1 ] = EasyConfig (None , rawtxt = rawtxt )
10641068
1065- self .mock_stdout (True )
1066- res = gh .det_patch_specs (patch_paths , file_info , [])
1067- self .mock_stdout (False )
1069+ with self .mocked_stdout ():
1070+ res = gh .det_patch_specs (patch_paths , file_info , [])
10681071
10691072 self .assertEqual ([i [0 ] for i in res ], patch_paths )
1070- self .assertEqual ([i [1 ] for i in res ], ['A' , 'patched_bundle' , 'patched_bundle' ])
1073+ self .assertEqual ([i [1 ] for i in res ], ['A' ] + [ 'patched_bundle' ] * 4 )
10711074
10721075 def test_github_restclient (self ):
10731076 """Test use of RestClient."""
0 commit comments