1120: #line 1470 "input_frame.ipk" 1121: def capture_output(self,command): 1122: "Capture the output from executing the shell command" 1123: commands = self.global_frame.commands 1124: status, output = commands.getstatusoutput(command) 1125: data = string.split(output,'\n') 1126: return (status,data) 1127: 1128: def print_output(self,command,description=None): 1129: "Weave output from executing the script, register it as a test case." 1130: status, data = self.capture_output(command) 1131: weaver = self.get_weaver() 1132: if description: cmd = description 1133: else: cmd = command 1134: weaver.test_output_head(cmd, status) 1135: for i in range(len(data)): 1136: line = data[i] 1137: l = string.rstrip(line) 1138: weaver.echotangle(i+1,l) 1139: weaver.test_output_foot(cmd, status) 1140: return (status, data) 1141: 1142: def capture_python_output(self,script): 1143: "Capture the output from executing the python script externally" 1144: return self.capture_output('"'+sys.executable+'" '+script) 1145: 1146: def print_python_output(self,script, description=None): 1147: "Weave output from executing the script externally" 1148: return self.print_output( 1149: '"'+sys.executable+'" '+script, 1150: description) 1151: 1152: def print_python_test_output(self,script, descr): 1153: "Weave output from executing the python script, register it as a test case." 1154: testno = self.pass_frame.get_new_test_number() 1155: testlabel = 'test_'+str(testno) 1156: self.pass_frame.tests[testno]=[descr,testlabel,'python','Unknown'] 1157: self.set_anchor(testlabel) 1158: return self.print_python_output(script,descr) 1159: