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