comparison cmd2.py @ 255:573bf9c2a043

multiple tests hanging, grr
author Catherine Devlin <catherine.devlin@gmail.com>
date Thu, 02 Apr 2009 13:10:17 -0400
parents 07dff0ba981e
children d62bb3dd58a0
comparison
equal deleted inserted replaced
254:07dff0ba981e 255:573bf9c2a043
1110 See example.py''' 1110 See example.py'''
1111 CmdApp = None 1111 CmdApp = None
1112 transcriptFileName = '' 1112 transcriptFileName = ''
1113 transcriptExtension = '' 1113 transcriptExtension = ''
1114 def fetchTranscripts(self): 1114 def fetchTranscripts(self):
1115 import pdb; pdb.set_trace()
1115 self.transcripts = [] 1116 self.transcripts = []
1116 if self.CmdApp.testfile: 1117 #if self.CmdApp.testfile:
1117 transcriptfilenames = [self.CmdApp.testfile] 1118 # transcriptfilenames = [self.CmdApp.testfile]
1118 elif self.transcriptExtension: 1119 if self.transcriptExtension:
1119 transcriptfilenames = glob.glob('*.' + self.transcriptExtension) 1120 transcriptfilenames = glob.glob('*.' + self.transcriptExtension)
1120 elif self.transcriptFileName: 1121 elif self.transcriptFileName:
1121 transcriptfilenames = [self.transcriptFileName] 1122 transcriptfilenames = [self.transcriptFileName]
1122 for fname in transcriptfilenames: 1123 for fname in transcriptfilenames:
1123 tfile = open(fname) 1124 tfile = open(fname)
1126 1127
1127 def setUp(self): 1128 def setUp(self):
1128 if self.CmdApp: 1129 if self.CmdApp:
1129 self.outputTrap = OutputTrap() 1130 self.outputTrap = OutputTrap()
1130 self.cmdapp = self.CmdApp() 1131 self.cmdapp = self.CmdApp()
1132 import pdb; pdb.set_trace()
1131 self.fetchTranscripts() 1133 self.fetchTranscripts()
1132 def assertEqualEnough(self, got, expected, message): 1134 def assertEqualEnough(self, got, expected, message):
1133 got = got.strip().splitlines() 1135 got = got.strip().splitlines()
1134 expected = expected.strip().splitlines() 1136 expected = expected.strip().splitlines()
1135 self.assertEqual(len(got), len(expected), message) 1137 self.assertEqual(len(got), len(expected), message)
1137 matchme = re.escape(lineexpected.strip()).replace('\\*', '.*'). \ 1139 matchme = re.escape(lineexpected.strip()).replace('\\*', '.*'). \
1138 replace('\\ ', ' ') 1140 replace('\\ ', ' ')
1139 self.assert_(re.match(matchme, linegot.strip()), message) 1141 self.assert_(re.match(matchme, linegot.strip()), message)
1140 def testall(self): 1142 def testall(self):
1141 if self.CmdApp: 1143 if self.CmdApp:
1142 self.fetchTranscripts()
1143 for transcript in self.transcripts: 1144 for transcript in self.transcripts:
1144 self._test_transcript(transcript) 1145 self._test_transcript(transcript)
1145 def _test_transcript(self, transcript): 1146 def _test_transcript(self, transcript):
1146 lineNum = 0 1147 lineNum = 0
1147 try: 1148 try: