##// END OF EJS Templates
move default log setup to _log_default from init_logging...
move default log setup to _log_default from init_logging allows classes to be passed log attribute, avoiding duplicate setup and occasional errors if things are done in the wrong order.

File last commit:

r3889:13fdc81c
r6883:d2f71ea5
Show More
test_logger.py
19 lines | 517 B | text/x-python | PythonLexer
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"""
import nose.tools as nt
_ip = get_ipython()
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