30f=open(self.filename,'rb')31headers=rfc822.Message(f)32c=f.read()33f.close()34ifnotheaders.keys():35raiseException(36"File %s has no headers"%self.filename)37self.description=headers['Description']38self.expect=headers.get('Expect','')39self.ignore=headers.get('Ignore')40self.options=[41o.strip()foroinheaders.get('Options','').split(',')42ifo.strip()]43parts=bar_re.split(c)44self.input=parts[0].rstrip()+'\n'45ifparts[1:]:46self.expect=parts[1].rstrip()+'\n'47else:48self.expect=None

79suite=unittest.TestSuite()80ifsys.version_info>=(2,4):81fordirinfeed_dirs:82forfninos.listdir(dir):83fn=os.path.join(dir,fn)84iffn.endswith('.data'):85case=FeedTestCase(fn)86suite.addTests([case])87# This is my lazy way of stopping on first error:88try:89case.runTest()90except:91break92returnsuite