Example #1
0
 def testshouldHaveItsOwnColor(self):
     fh = open('config','w')
     fh.write(self.logname+'='+'green\n')
     fh.close()
     properties = Property('config')
     properties.parse_properties()
     log = Log(self.logname,properties)
     log.openLog()
     self.assertTrue(log.ownOutputColor)
     log.closeLog()
     os.remove(self.config)
Example #2
0
 def testReportResumeForTwoDifferentLogs(self):
     log = Log('out.log')
     log2 = Log('out2.log')
     arrayLogs = [log, log2]
     fh = log.openLog()
     logcolors = LogColors()
     message = Message(logcolors)
     resume = reporting.Resume(arrayLogs)
     for anylog in arrayLogs:
         self.readAndUpdateLines(anylog,message,resume)
     outlogReport = resume.logsReport[log.path]
     expectedOutLogErrorReport = 'error> not so wrong'
     gotLogTrace = outlogReport['ERROR'][0].split('=>> ')[1]
     self.assertEquals(expectedOutLogErrorReport,
             gotLogTrace)
Example #3
0
 def testMessage(self):
     logcolors = LogColors() #using default colors
     termcolors = TermColorCodes()
     target = None
     notifier = notifications.Print()
     message = Message(logcolors,target)
     log = Log(self.logfile)
     log.openLog()
     sys.stdout = Writer()
     #testing Colors with default pauseModes
     for count in range(len(self.someLogTraces)):
         line = log.readLine()
         line = line.rstrip()
         level = line.split('>')
         message.parse(line, log)
         output = logcolors.getLevelColor(level[0])+line+termcolors.reset
         notifier.notify(message,log)
         self.assertTrue(output in sys.stdout.captured)
     
     line = log.readLine()
     self.assertEqual('',line)
     message.parse(line, log)
     self.assertFalse(notifier.notify(message,log))
Example #4
0
 def openLog(self):
     log = Log(self.logname)
     log.openLog()
     return log