def full_cycle(self, **kw): params = dict(type='stream', name='stdout') params.update(kw) with LogCapture(): with OutputCapture(separate=True) as output: plugin = Plugin(**Plugin.schema(params)) logger.info('before') plugin.start() logger.info('during-info') logger.error('during-error') plugin.finish() logger.info('after') return output
def test_schema_invalid_string_level(self): text = "no log level named 'foo' for dictionary value @ data['level']" with ShouldFailSchemaWith(text): Plugin.schema(dict(type='stream', name='stderr', level='foo'))
def test_schema_integer_level(self): compare(dict(type='stream', name='stdout', level=0), Plugin.schema(dict(type='stream', name='stdout', level=0)))
def test_schema_invalid_stream_name(self): text = "not a valid value for dictionary value @ data['name']" with ShouldFailSchemaWith(text): Plugin.schema(dict(type='stream', name='stdfoo'))
def test_schema_maximal(self): compare(dict(type='stream', name='stdout', level=INFO, fmt='foo', datefmt='bar'), Plugin.schema(dict(type='stream', name='stdout', level='InFo', fmt='foo', datefmt='bar')))
def test_schema_minimal(self): compare(dict(type='stream', name='stdout'), Plugin.schema(dict(type='stream', name='stdout')))