← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1413805] Re: capture text logged in integration tests to a file

 

** Changed in: horizon
       Status: Incomplete => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1413805

Title:
  capture text logged  in integration tests to a file

Status in OpenStack Dashboard (Horizon):
  Invalid

Bug description:
   the unittest2 runner replaces sys.stdout/sys.stderr before the
  testing starts, and the StreamHandler is still writing to the original
  sys.stdout.

  To assign the 'current' sys.stdout to the handler

  
  import sys
  import unittest
  import logging

  logger = logging.getLogger()
  logger.level = logging.DEBUG

  class TestCase(unittest.TestCase):
      def Setup(self):
          //stream_handler = logging.StreamHandler(sys.stdout)
          self.handler =  logging.StreamHandler(sys.stdout)
          logger.addHandler(stream_handler)
          
    def Teardown()
          logger.removeHandler(stream_handler)

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1413805/+subscriptions


References