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