def setUpClass(cls): super(BaseTestFixture, cls).setUpClass() #Master Config Provider #Setup root log handler only if the root logger doesn't already haves if cclogging.getLogger('').handlers == []: cclogging.getLogger('').addHandler( cclogging.setup_new_cchandler('cc.master')) #Setup fixture log, which is really just a copy of the master log #for the duration of this test fixture cls.fixture_log = cclogging.getLogger('') cls._fixture_log_handler = cclogging.setup_new_cchandler( cclogging.get_object_namespace(cls)) cls.fixture_log.addHandler(cls._fixture_log_handler) """ @todo: Upgrade the metrics to be more unittest compatible. Currently the unittest results are not available at the fixture level, only the test case or the test suite and runner level. """ # Setup the fixture level metrics cls.fixture_metrics = TestRunMetrics() cls.fixture_metrics.timer.start() # Report cls.fixture_log.info("{0}".format('=' * 56)) cls.fixture_log.info("Fixture...: {0}".format( str(cclogging.get_object_namespace(cls)))) cls.fixture_log.info("Created At: {0}" .format(cls.fixture_metrics.timer.start_time)) cls.fixture_log.info("{0}".format('=' * 56))
def setUpClass(cls): super(BaseTestFixture, cls).setUpClass() #Master Config Provider #Setup root log handler only if the root logger doesn't already haves if cclogging.getLogger('').handlers == []: cclogging.getLogger('').addHandler( cclogging.setup_new_cchandler('cc.master')) #Setup fixture log, which is really just a copy of the master log #for the duration of this test fixture cls.fixture_log = cclogging.getLogger('') cls._fixture_log_handler = cclogging.setup_new_cchandler( cclogging.get_object_namespace(cls)) cls.fixture_log.addHandler(cls._fixture_log_handler) ''' @todo: Upgrade the metrics to be more unittest compatible. Currently the unittest results are not available at the fixture level, only the test case or the test suite and runner level. ''' # Setup the fixture level metrics cls.fixture_metrics = TestRunMetrics() cls.fixture_metrics.timer.start() # Report cls.fixture_log.info("{0}".format('=' * 56)) cls.fixture_log.info("Fixture...: {0}".format( str(cclogging.get_object_namespace(cls)))) cls.fixture_log.info("Created At: {0}".format( cls.fixture_metrics.timer.start_time)) cls.fixture_log.info("{0}".format('=' * 56))
def _start_logging(self, log_file_name): setattr(self.func, "_log_handler", cclogging.setup_new_cchandler(log_file_name)) setattr(self.func, "_log", cclogging.getLogger("")) self.func._log.addHandler(self.func._log_handler) try: curframe = inspect.currentframe() self.func._log.debug("{0} called from {1}".format(self.__name__, inspect.getouterframes(curframe, 2)[2][3])) except: self.func._log.debug("Unable to log where {0} was called from".format(self.__name__))
def _start_logging(self, log_file_name): """Starts logging""" setattr(self.func, '_log_handler', cclogging.setup_new_cchandler( log_file_name)) setattr(self.func, '_log', cclogging.getLogger('')) self.func._log.addHandler(self.func._log_handler) try: curframe = inspect.currentframe() self.func._log.debug("{0} called from {1}".format( self.__name__, inspect.getouterframes(curframe, 2)[2][3])) except: self.func._log.debug( "Unable to log where {0} was called from".format( self.__name__))
def __init__(self, parent_object): self.log = getLogger('') self.log_handler = setup_new_cchandler( get_object_namespace(parent_object)) self._is_logging = False
def __init__(self, parent_object): self.log = getLogger('') self.log_handler = setup_new_cchandler( get_object_namespace(parent_object)) self._is_logging = False