##// END OF EJS Templates
use TemporaryDirectory ctx manager in test_render_unicode_cwd
MinRK -
Show More
@@ -1,7 +1,6 b''
1 1 # -*- coding: utf-8
2 2 """Tests for prompt generation."""
3 3
4 import tempfile
5 4 import unittest
6 5
7 6 import os
@@ -10,6 +9,7 b' import nose.tools as nt'
10 9 from IPython.testing import tools as tt, decorators as dec
11 10 from IPython.core.prompts import PromptManager
12 11 from IPython.testing.globalipapp import get_ipython
12 from IPython.utils.tempdir import TemporaryDirectory
13 13
14 14 ip = get_ipython()
15 15
@@ -64,14 +64,11 b' class PromptTests(unittest.TestCase):'
64 64 self.pm.in_template = r'\#>'
65 65 self.assertEqual(self.pm.render('in',color=False), '%d>' % ip.execution_count)
66 66
67 def test_render_unicode(self):
68 td = tempfile.mkdtemp(u'ünicødé')
67 def test_render_unicode_cwd(self):
69 68 save = os.getcwdu()
69 with TemporaryDirectory(u'ünicødé') as td:
70 70 os.chdir(td)
71 71 self.pm.in_template = r'\w [\#]'
72 try:
73 72 p = self.pm.render('in', color=False)
74 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