@@ -106,21 +106,26 @@ def tearDown(self):
106106 if os .path .exists (self .dummylogfn ):
107107 os .remove (self .dummylogfn )
108108
109- def check_toy (self , installpath , outtxt , version = '0.0' , versionprefix = '' , versionsuffix = '' ):
109+ def check_toy (self , installpath , outtxt , version = '0.0' , versionprefix = '' , versionsuffix = '' , error = None ):
110110 """Check whether toy build succeeded."""
111111
112112 full_version = '' .join ([versionprefix , version , versionsuffix ])
113113
114+ if error is not None :
115+ error_msg = '\n Note: Caught error: %s' % error
116+ else :
117+ error_msg = ''
118+
114119 # check for success
115120 success = re .compile (r"COMPLETED: Installation (ended|STOPPED) successfully \(took .* secs?\)" )
116- self .assertTrue (success .search (outtxt ), "COMPLETED message found in '%s" % outtxt )
121+ self .assertTrue (success .search (outtxt ), "COMPLETED message found in '%s'%s " % ( outtxt , error_msg ) )
117122
118123 # if the module exists, it should be fine
119124 toy_module = os .path .join (installpath , 'modules' , 'all' , 'toy' , full_version )
120125 msg = "module for toy build toy/%s found (path %s)" % (full_version , toy_module )
121126 if get_module_syntax () == 'Lua' :
122127 toy_module += '.lua'
123- self .assertTrue (os .path .exists (toy_module ), msg )
128+ self .assertTrue (os .path .exists (toy_module ), msg + error_msg )
124129
125130 # module file is symlinked according to moduleclass
126131 toy_module_symlink = os .path .join (installpath , 'modules' , 'tools' , 'toy' , full_version )
@@ -183,7 +188,7 @@ def test_toy_build(self, extra_args=None, ec_file=None, tmpdir=None, verify=True
183188 raise myerr
184189
185190 if verify :
186- self .check_toy (self .test_installpath , outtxt , versionsuffix = versionsuffix )
191+ self .check_toy (self .test_installpath , outtxt , versionsuffix = versionsuffix , error = myerr )
187192
188193 if test_readme :
189194 # make sure postinstallcmds were used
0 commit comments