##// END OF EJS Templates
Merge pull request #12884 from MrMino/vi_mode_prompt_strip...
Merge pull request #12884 from MrMino/vi_mode_prompt_strip Strip vi-mode style prompts from the input

File last commit:

r25094:59d93919
r26497:9cbb3ba6 merge
Show More
test_logger.py
30 lines | 896 B | text/x-python | PythonLexer
Fernando Perez
Add missing encoding declaration to file with unicode in it.
r7115 # -*- coding: utf-8 -*-
Thomas Kluyver
Add test that, if we failed to open the log file, we don't try to write to it.
r3889 """Test IPython.core.logger"""
Thomas Kluyver
Add test for unicode in logging.
r7082 import os.path
Thomas Kluyver
Add test that, if we failed to open the log file, we don't try to write to it.
r3889 import nose.tools as nt
Thomas Kluyver
Add test for unicode in logging.
r7082 from IPython.utils.tempdir import TemporaryDirectory
Thomas Kluyver
Add test that, if we failed to open the log file, we don't try to write to it.
r3889
def test_logstart_inaccessible_file():
try:
_ip.logger.logstart(logfname="/") # Opening that filename will fail.
except IOError:
pass
else:
nt.assert_true(False) # The try block should never pass.
try:
_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
Thomas Kluyver
Add test for unicode in logging.
r7082
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()