comparison cmd2.py @ 345:6fe1e75e3a67

transcript test wasn't running pre and post cmd hooks
author catherine@Drou
date Tue, 16 Feb 2010 15:13:11 -0500
parents 787573d350c5
children 49dd1ce6cfd6
comparison
equal deleted inserted replaced
344:4300ef912f4a 345:6fe1e75e3a67
1471 command = [line[len(self.cmdapp.prompt):]] 1471 command = [line[len(self.cmdapp.prompt):]]
1472 line = transcript.next() 1472 line = transcript.next()
1473 while line.startswith(self.cmdapp.continuation_prompt): 1473 while line.startswith(self.cmdapp.continuation_prompt):
1474 command.append(line[len(self.cmdapp.continuation_prompt):]) 1474 command.append(line[len(self.cmdapp.continuation_prompt):])
1475 line = transcript.next() 1475 line = transcript.next()
1476 command = ''.join(command) 1476 command = ''.join(command)
1477 self.cmdapp.onecmd(command) 1477 command = self.cmdapp.precmd(command)
1478 stop = self.cmdapp.onecmd(command)
1479 stop = self.cmdapp.postcmd(stop, command)
1480 #TODO: should act on ``stop``
1478 result = self.outputTrap.read() 1481 result = self.outputTrap.read()
1479 if line.startswith(self.cmdapp.prompt): 1482 if line.startswith(self.cmdapp.prompt):
1480 message = '\nFile %s, line %d\nCommand was:\n%s\nExpected: (nothing)\nGot:\n%s\n'%\ 1483 message = '\nFile %s, line %d\nCommand was:\n%s\nExpected: (nothing)\nGot:\n%s\n'%\
1481 (fname, lineNum, command, result) 1484 (fname, lineNum, command, result)
1482 self.assert_(not(result.strip()), message) 1485 self.assert_(not(result.strip()), message)