Show More
@@ -15,7 +15,7 b' import nose.tools as nt' | |||||
15 | from IPython.config.loader import Config |
|
15 | from IPython.config.loader import Config | |
16 | from IPython.core import completer |
|
16 | from IPython.core import completer | |
17 | from IPython.external.decorators import knownfailureif |
|
17 | from IPython.external.decorators import knownfailureif | |
18 | from IPython.utils.tempdir import TemporaryDirectory |
|
18 | from IPython.utils.tempdir import TemporaryDirectory, TemporaryWorkingDirectory | |
19 | from IPython.utils.generics import complete_object |
|
19 | from IPython.utils.generics import complete_object | |
20 | from IPython.utils import py3compat |
|
20 | from IPython.utils import py3compat | |
21 | from IPython.utils.py3compat import string_types, unicode_type |
|
21 | from IPython.utils.py3compat import string_types, unicode_type | |
@@ -189,10 +189,7 b' def test_abspath_file_completions():' | |||||
189 |
|
189 | |||
190 | def test_local_file_completions(): |
|
190 | def test_local_file_completions(): | |
191 | ip = get_ipython() |
|
191 | ip = get_ipython() | |
192 | cwd = py3compat.getcwd() |
|
192 | with TemporaryWorkingDirectory(): | |
193 | try: |
|
|||
194 | with TemporaryDirectory() as tmpdir: |
|
|||
195 | os.chdir(tmpdir) |
|
|||
196 |
|
|
193 | prefix = './foo' | |
197 |
|
|
194 | suffixes = ['1', '2'] | |
198 |
|
|
195 | names = [prefix+s for s in suffixes] | |
@@ -208,9 +205,6 b' def test_local_file_completions():' | |||||
208 |
|
|
205 | c = ip.complete(prefix, cmd)[1] | |
209 |
|
|
206 | comp = [prefix+s for s in suffixes] | |
210 |
|
|
207 | nt.assert_equal(c, comp) | |
211 | finally: |
|
|||
212 | # prevent failures from making chdir stick |
|
|||
213 | os.chdir(cwd) |
|
|||
214 |
|
208 | |||
215 |
|
209 | |||
216 | def test_greedy_completions(): |
|
210 | def test_greedy_completions(): |
@@ -8,7 +8,7 b' import os' | |||||
8 | from IPython.testing import tools as tt, decorators as dec |
|
8 | from IPython.testing import tools as tt, decorators as dec | |
9 | from IPython.core.prompts import PromptManager, LazyEvaluate |
|
9 | from IPython.core.prompts import PromptManager, LazyEvaluate | |
10 | from IPython.testing.globalipapp import get_ipython |
|
10 | from IPython.testing.globalipapp import get_ipython | |
11 | from IPython.utils.tempdir import TemporaryDirectory |
|
11 | from IPython.utils.tempdir import TemporaryWorkingDirectory | |
12 | from IPython.utils import py3compat |
|
12 | from IPython.utils import py3compat | |
13 | from IPython.utils.py3compat import unicode_type |
|
13 | from IPython.utils.py3compat import unicode_type | |
14 |
|
14 | |||
@@ -67,13 +67,10 b' class PromptTests(unittest.TestCase):' | |||||
67 |
|
67 | |||
68 | @dec.onlyif_unicode_paths |
|
68 | @dec.onlyif_unicode_paths | |
69 | def test_render_unicode_cwd(self): |
|
69 | def test_render_unicode_cwd(self): | |
70 | save = py3compat.getcwd() |
|
70 | with TemporaryWorkingDirectory(u'ünicødé'): | |
71 | with TemporaryDirectory(u'ünicødé') as td: |
|
|||
72 | os.chdir(td) |
|
|||
73 | self.pm.in_template = r'\w [\#]' |
|
71 | self.pm.in_template = r'\w [\#]' | |
74 | p = self.pm.render('in', color=False) |
|
72 | p = self.pm.render('in', color=False) | |
75 | self.assertEqual(p, u"%s [%i]" % (py3compat.getcwd(), ip.execution_count)) |
|
73 | self.assertEqual(p, u"%s [%i]" % (py3compat.getcwd(), ip.execution_count)) | |
76 | os.chdir(save) |
|
|||
77 |
|
74 | |||
78 | def test_lazy_eval_unicode(self): |
|
75 | def test_lazy_eval_unicode(self): | |
79 | u = u'ünicødé' |
|
76 | u = u'ünicødé' |
General Comments 0
You need to be logged in to leave comments.
Login now