Skip to content

Commit

Permalink
Add test for unicode in logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed May 30, 2012
1 parent 0eeff21 commit 773bd4c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions IPython/core/logger.py
Expand Up @@ -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"""
Expand Down
14 changes: 13 additions & 1 deletion 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()

Expand All @@ -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.