def test_underscore_lazy(self): # set lazy off gettextutils.USE_LAZY = False gettextutils.enable_lazy() result = gettextutils._("blah") self.assertIsInstance(result, gettextutils.Message)
def test_gettextutils_install_with_enable(self): gettextutils.install('blaa') self.assertTrue(isinstance(_('A String'), six.text_type)) # noqa gettextutils.enable_lazy() self.assertTrue(isinstance(_('A Message'), # noqa gettextutils.Message))
def test_underscore_lazy(self): # set lazy off gettextutils.USE_LAZY = False gettextutils.enable_lazy() result = gettextutils._('blah') self.assertIsInstance(result, gettextutils.Message)
def test_underscore_lazy(self): # set lazy off gettextutils.USE_LAZY = False gettextutils.enable_lazy() result = gettextutils._('blah') self.assertIsInstance(result, gettextutils.Message) self.assertEqual('oslo', result.domain)
def prepare_service(argv=None): gettextutils.install('openstack') gettextutils.enable_lazy() log_levels = (cfg.CONF.default_log_levels) cfg.set_defaults(log.log_opts, default_log_levels=log_levels) if argv is None: argv = sys.argv cfg.CONF(argv[1:], project='monasca-anomaly') log.setup('monasca-anomaly') LOG.info('Service has started!')
def prepare_service(argv=None): gettextutils.install('openstack') gettextutils.enable_lazy() log_levels = (cfg.CONF.default_log_levels) cfg.set_defaults(log.log_opts, default_log_levels=log_levels) if argv is None: argv = sys.argv cfg.CONF(argv[1:], project='persister') log.setup('persister') LOG.info('Service has started!')
def test_enable_lazy(self): gettextutils.USE_LAZY = False gettextutils.enable_lazy() # assert now enabled self.assertTrue(gettextutils.USE_LAZY)
def test_lazy(self): # set lazy on gettextutils.enable_lazy() result = self.translator('blah') self.assertIsInstance(result, gettextutils.Message) self.assertEqual('oslo-log-' + self.level, result.domain)
def test_lazy(self): with mock.patch.object(gettextutils, 'Message') as msg: tf = gettextutils.TranslatorFactory('domain') gettextutils.enable_lazy() tf.primary('some text') msg.assert_called_with('some text', domain='domain')