##// END OF EJS Templates
more useful feedback on style checker...
more useful feedback on style checker - give copy-pasteable command to fix formatting with `darker` - use $TRAVIS_COMMIT_RANGE to limit to PR, instead of hardcoded ref - only run on pull requests - run style check before tests, for quicker feedback

File last commit:

r25094:59d93919
r26004:1d0656e6
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()