Permalink
Browse files

Add test for unicode in logging.

  • Loading branch information...
1 parent 0eeff21 commit 773bd4c5449627f9971cb7437b9092bb8e7abca8 @takluyver committed May 30, 2012
Showing with 15 additions and 3 deletions.
  1. +2 −2 IPython/core/logger.py
  2. +13 −1 IPython/core/tests/test_logger.py
@@ -62,8 +62,8 @@ def _get_mode(self):
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"""
@@ -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()

0 comments on commit 773bd4c

Please sign in to comment.