From 773bd4c5449627f9971cb7437b9092bb8e7abca8 2012-05-30 21:21:18 From: Thomas Kluyver Date: 2012-05-30 21:21:18 Subject: [PATCH] Add test for unicode in logging. --- diff --git a/IPython/core/logger.py b/IPython/core/logger.py index 8a42dba..56bc4d2 100644 --- a/IPython/core/logger.py +++ b/IPython/core/logger.py @@ -62,8 +62,8 @@ class Logger(object): logmode = property(_get_mode,_set_mode) - def logstart(self,logfname=None,loghead=None,logmode=None, - log_output=False,timestamp=False,log_raw_input=False): + def logstart(self, logfname=None, loghead=None, logmode=None, + log_output=False, timestamp=False, log_raw_input=False): """Generate a new log-file with a default header. Raises RuntimeError if the log has already been started""" diff --git a/IPython/core/tests/test_logger.py b/IPython/core/tests/test_logger.py index 9b340e9..7ac7661 100644 --- a/IPython/core/tests/test_logger.py +++ b/IPython/core/tests/test_logger.py @@ -1,6 +1,9 @@ """Test IPython.core.logger""" +import os.path + import nose.tools as nt +from IPython.utils.tempdir import TemporaryDirectory _ip = get_ipython() @@ -16,4 +19,13 @@ def test_logstart_inaccessible_file(): _ip.run_cell("a=1") # Check it doesn't try to log this finally: _ip.logger.log_active = False # If this fails, don't let later tests fail - + +def test_logstart_unicode(): + with TemporaryDirectory() as tdir: + logfname = os.path.join(tdir, "test_unicode.log") + _ip.run_cell("'abc€'") + try: + _ip.magic("logstart -to %s" % logfname) + _ip.run_cell("'abc€'") + finally: + _ip.logger.logstop()