def configure_loggers(): warnings.simplefilter(action='once', category=InsecurePlatformWarning) # first off, configure defaults # to enable the use of the logger # even before the init was executed. _configure_defaults() from cloudify_cli import utils if utils.is_initialized(): # init was already called # use the configuration file. _configure_from_file() global _lgr _lgr = logging.getLogger('cloudify.cli.main') # configuring events/logs loggers # (this will also affect local workflow loggers, which don't use # the get_events_logger method of this module) if utils.is_use_colors(): logs.EVENT_CLASS = ColorfulEvent # refactor this elsewhere if colorama is further used in CLI colorama.init(autoreset=True)
def test_missing_colors_configuration(self): # when colors configuration is missing, default should be false with open(self.config_file_path, 'w') as f: yaml.dump({}, f) self.assertFalse(utils.is_use_colors())
def test_colors_configuration(self): self.assertTrue(utils.is_use_colors())
def test_colors_configuration(self): self.assertEquals(True, utils.is_use_colors())
def test_missing_colors_configuration(self): # when colors configuration is missing, default should be false with open(self.config_file_path, 'w') as f: yaml.dump({}, f) self.assertEquals(False, utils.is_use_colors())