Show More
@@ -1,7 +1,6 b'' | |||||
1 | # -*- coding: utf-8 |
|
1 | # -*- coding: utf-8 | |
2 | """Tests for prompt generation.""" |
|
2 | """Tests for prompt generation.""" | |
3 |
|
3 | |||
4 | import tempfile |
|
|||
5 | import unittest |
|
4 | import unittest | |
6 |
|
5 | |||
7 | import os |
|
6 | import os | |
@@ -10,6 +9,7 b' import nose.tools as nt' | |||||
10 | from IPython.testing import tools as tt, decorators as dec |
|
9 | from IPython.testing import tools as tt, decorators as dec | |
11 | from IPython.core.prompts import PromptManager |
|
10 | from IPython.core.prompts import PromptManager | |
12 | from IPython.testing.globalipapp import get_ipython |
|
11 | from IPython.testing.globalipapp import get_ipython | |
|
12 | from IPython.utils.tempdir import TemporaryDirectory | |||
13 |
|
13 | |||
14 | ip = get_ipython() |
|
14 | ip = get_ipython() | |
15 |
|
15 | |||
@@ -64,14 +64,11 b' class PromptTests(unittest.TestCase):' | |||||
64 | self.pm.in_template = r'\#>' |
|
64 | self.pm.in_template = r'\#>' | |
65 | self.assertEqual(self.pm.render('in',color=False), '%d>' % ip.execution_count) |
|
65 | self.assertEqual(self.pm.render('in',color=False), '%d>' % ip.execution_count) | |
66 |
|
66 | |||
67 | def test_render_unicode(self): |
|
67 | def test_render_unicode_cwd(self): | |
68 | td = tempfile.mkdtemp(u'ünicødé') |
|
|||
69 | save = os.getcwdu() |
|
68 | save = os.getcwdu() | |
|
69 | with TemporaryDirectory(u'ünicødé') as td: | |||
70 | os.chdir(td) |
|
70 | os.chdir(td) | |
71 | self.pm.in_template = r'\w [\#]' |
|
71 | self.pm.in_template = r'\w [\#]' | |
72 | try: |
|
|||
73 | p = self.pm.render('in', color=False) |
|
72 | p = self.pm.render('in', color=False) | |
74 | self.assertEquals(p, u"%s [%i]" % (os.getcwdu(), ip.execution_count)) |
|
73 | self.assertEquals(p, u"%s [%i]" % (os.getcwdu(), ip.execution_count)) | |
75 | finally: |
|
|||
76 |
|
|
74 | os.chdir(save) | |
77 | os.rmdir(td) |
|
General Comments 0
You need to be logged in to leave comments.
Login now