Mercurial > babel > old > babel-test
diff babel/messages/tests/frontend.py @ 524:4a5340c0821b stable-0.9.x
merge r573, r575 from trunk to 0.9 branch
author | fschwarz |
---|---|
date | Sat, 05 Mar 2011 14:58:58 +0000 |
parents | dbb70d75718a |
children | d71a490c11df |
line wrap: on
line diff
--- a/babel/messages/tests/frontend.py +++ b/babel/messages/tests/frontend.py @@ -16,6 +16,7 @@ from distutils.errors import DistutilsOptionError from distutils.log import _global_log import doctest +import logging import os import shutil from StringIO import StringIO @@ -509,6 +510,14 @@ sys.argv = ['pybabel'] sys.stdout = StringIO() sys.stderr = StringIO() + + # Logging handlers will be reused if possible (#227). This breaks the + # implicit assumption that our newly created StringIO for sys.stderr + # contains the console output. Removing the old handler ensures that a + # new handler with our new StringIO instance will be used. + log = logging.getLogger('babel') + for handler in log.handlers: + log.removeHandler(handler) self.cli = frontend.CommandLineInterface() def tearDown(self):