##// END OF EJS Templates
Add missing encoding declaration to file with unicode in it.
Fernando Perez -
Show More
@@ -1,31 +1,32 b''
1 # -*- coding: utf-8 -*-
1 """Test IPython.core.logger"""
2 """Test IPython.core.logger"""
2
3
3 import os.path
4 import os.path
4
5
5 import nose.tools as nt
6 import nose.tools as nt
6 from IPython.utils.tempdir import TemporaryDirectory
7 from IPython.utils.tempdir import TemporaryDirectory
7
8
8 _ip = get_ipython()
9 _ip = get_ipython()
9
10
10 def test_logstart_inaccessible_file():
11 def test_logstart_inaccessible_file():
11 try:
12 try:
12 _ip.logger.logstart(logfname="/") # Opening that filename will fail.
13 _ip.logger.logstart(logfname="/") # Opening that filename will fail.
13 except IOError:
14 except IOError:
14 pass
15 pass
15 else:
16 else:
16 nt.assert_true(False) # The try block should never pass.
17 nt.assert_true(False) # The try block should never pass.
17
18
18 try:
19 try:
19 _ip.run_cell("a=1") # Check it doesn't try to log this
20 _ip.run_cell("a=1") # Check it doesn't try to log this
20 finally:
21 finally:
21 _ip.logger.log_active = False # If this fails, don't let later tests fail
22 _ip.logger.log_active = False # If this fails, don't let later tests fail
22
23
23 def test_logstart_unicode():
24 def test_logstart_unicode():
24 with TemporaryDirectory() as tdir:
25 with TemporaryDirectory() as tdir:
25 logfname = os.path.join(tdir, "test_unicode.log")
26 logfname = os.path.join(tdir, "test_unicode.log")
26 _ip.run_cell("'abc€'")
27 _ip.run_cell("'abc€'")
27 try:
28 try:
28 _ip.magic("logstart -to %s" % logfname)
29 _ip.magic("logstart -to %s" % logfname)
29 _ip.run_cell("'abc€'")
30 _ip.run_cell("'abc€'")
30 finally:
31 finally:
31 _ip.logger.logstop()
32 _ip.logger.logstop()
General Comments 0
You need to be logged in to leave comments. Login now