Show More
@@ -15,7 +15,7 b' from os.path import join, abspath' | |||||
15 | from imp import reload |
|
15 | from imp import reload | |
16 |
|
16 | |||
17 | from nose import SkipTest, with_setup |
|
17 | from nose import SkipTest, with_setup | |
18 | import nose.tools as nt |
|
18 | import pytest | |
19 |
|
19 | |||
20 | import IPython |
|
20 | import IPython | |
21 | from IPython import paths |
|
21 | from IPython import paths | |
@@ -155,7 +155,7 b' def test_get_home_dir_5():' | |||||
155 | env['HOME'] = abspath(HOME_TEST_DIR+'garbage') |
|
155 | env['HOME'] = abspath(HOME_TEST_DIR+'garbage') | |
156 | # set os.name = posix, to prevent My Documents fallback on Windows |
|
156 | # set os.name = posix, to prevent My Documents fallback on Windows | |
157 | os.name = 'posix' |
|
157 | os.name = 'posix' | |
158 |
|
|
158 | pytest.raises(path.HomeDirError, path.get_home_dir, True) | |
159 |
|
159 | |||
160 | # Should we stub wreg fully so we can run the test on all platforms? |
|
160 | # Should we stub wreg fully so we can run the test on all platforms? | |
161 | @skip_if_not_win32 |
|
161 | @skip_if_not_win32 | |
@@ -237,8 +237,7 b' def test_get_xdg_dir_3():' | |||||
237 | env.pop('IPYTHONDIR', None) |
|
237 | env.pop('IPYTHONDIR', None) | |
238 | env.pop('XDG_CONFIG_HOME', None) |
|
238 | env.pop('XDG_CONFIG_HOME', None) | |
239 | cfgdir=os.path.join(path.get_home_dir(), '.config') |
|
239 | cfgdir=os.path.join(path.get_home_dir(), '.config') | |
240 | if not os.path.exists(cfgdir): |
|
240 | os.makedirs(cfgdir, exist_ok=True) | |
241 | os.makedirs(cfgdir) |
|
|||
242 |
|
241 | |||
243 | assert path.get_xdg_dir() is None |
|
242 | assert path.get_xdg_dir() is None | |
244 |
|
243 | |||
@@ -305,15 +304,15 b' def test_get_py_filename():' | |||||
305 | assert path.get_py_filename("foo") == "foo.py" |
|
304 | assert path.get_py_filename("foo") == "foo.py" | |
306 | with make_tempfile("foo"): |
|
305 | with make_tempfile("foo"): | |
307 | assert path.get_py_filename("foo") == "foo" |
|
306 | assert path.get_py_filename("foo") == "foo" | |
308 |
|
|
307 | pytest.raises(IOError, path.get_py_filename, "foo.py") | |
309 |
|
|
308 | pytest.raises(IOError, path.get_py_filename, "foo") | |
310 |
|
|
309 | pytest.raises(IOError, path.get_py_filename, "foo.py") | |
311 | true_fn = "foo with spaces.py" |
|
310 | true_fn = "foo with spaces.py" | |
312 | with make_tempfile(true_fn): |
|
311 | with make_tempfile(true_fn): | |
313 | assert path.get_py_filename("foo with spaces") == true_fn |
|
312 | assert path.get_py_filename("foo with spaces") == true_fn | |
314 | assert path.get_py_filename("foo with spaces.py") == true_fn |
|
313 | assert path.get_py_filename("foo with spaces.py") == true_fn | |
315 |
|
|
314 | pytest.raises(IOError, path.get_py_filename, '"foo with spaces.py"') | |
316 |
|
|
315 | pytest.raises(IOError, path.get_py_filename, "'foo with spaces.py'") | |
317 |
|
316 | |||
318 | @onlyif_unicode_paths |
|
317 | @onlyif_unicode_paths | |
319 | def test_unicode_in_filename(): |
|
318 | def test_unicode_in_filename(): | |
@@ -414,7 +413,7 b' def test_ensure_dir_exists():' | |||||
414 | path.ensure_dir_exists(d) # no-op |
|
413 | path.ensure_dir_exists(d) # no-op | |
415 | f = os.path.join(td, 'ƒile') |
|
414 | f = os.path.join(td, 'ƒile') | |
416 | open(f, 'w').close() # touch |
|
415 | open(f, 'w').close() # touch | |
417 |
with |
|
416 | with pytest.raises(IOError): | |
418 | path.ensure_dir_exists(f) |
|
417 | path.ensure_dir_exists(f) | |
419 |
|
418 | |||
420 | class TestLinkOrCopy(unittest.TestCase): |
|
419 | class TestLinkOrCopy(unittest.TestCase): |
General Comments 0
You need to be logged in to leave comments.
Login now