Skip to content

Commit

Permalink
Added basic unicode testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Sep 25, 2010
1 parent 22020e4 commit 9845bc8
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion benchmark/bench_file_handler.py
Expand Up @@ -10,4 +10,4 @@ def run():
f = NamedTemporaryFile()
with FileHandler(f.name) as handler:
for x in xrange(500):
log.warning('this is not handled')
log.warning('this is handled')
13 changes: 13 additions & 0 deletions benchmark/bench_file_handler_unicode.py
@@ -0,0 +1,13 @@
"""Benchmarks the file handler with unicode"""
from logbook import Logger, FileHandler
from tempfile import NamedTemporaryFile


log = Logger('Test logger')


def run():
f = NamedTemporaryFile()
with FileHandler(f.name) as handler:
for x in xrange(500):
log.warning(u'this is handled \x6f')
7 changes: 7 additions & 0 deletions benchmark/bench_logger_creation.py
@@ -0,0 +1,7 @@
"""Test with no handler active"""
from logbook import Logger


def run():
for x in xrange(500):
Logger('Test')
2 changes: 1 addition & 1 deletion benchmark/bench_logging_file_handler.py
Expand Up @@ -11,4 +11,4 @@ def run():
handler = FileHandler(f.name)
log.addHandler(handler)
for x in xrange(500):
log.warning('this is not handled')
log.warning('this is handled')
14 changes: 14 additions & 0 deletions benchmark/bench_logging_file_handler_unicode.py
@@ -0,0 +1,14 @@
"""Tests logging file handler in comparison"""
from logging import getLogger, FileHandler
from tempfile import NamedTemporaryFile


log = getLogger('Testlogger')


def run():
f = NamedTemporaryFile()
handler = FileHandler(f.name)
log.addHandler(handler)
for x in xrange(500):
log.warning(u'this is handled \x6f')
11 changes: 11 additions & 0 deletions benchmark/bench_logging_logger_creation.py
@@ -0,0 +1,11 @@
"""Test with no handler active"""
from logging import getLogger


root_logger = getLogger()


def run():
for x in xrange(500):
getLogger('Test')
del root_logger.manager.loggerDict['Test']

0 comments on commit 9845bc8

Please sign in to comment.