##// END OF EJS Templates
[lib][tests][deepreload] Remove nose
[lib][tests][deepreload] Remove nose

File last commit:

r26750:7b2546d2
r26913:a1ddd3bc
Show More
test_logger.py
30 lines | 864 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
Tomasz Kłoczko
nose2pytest migration batch 1...
r26749 import pytest
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:
Blazej Michalik
Darker
r26750 assert False # The try block should never pass.
Thomas Kluyver
Add test that, if we failed to open the log file, we don't try to write to it.
r3889 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()