##// END OF EJS Templates
test ensure_dir_exists
MinRK -
Show More
@@ -1,18 +1,8 b''
1 # encoding: utf-8
1 # encoding: utf-8
2 """Tests for IPython.utils.path.py"""
2 """Tests for IPython.utils.path.py"""
3
3
4 #-----------------------------------------------------------------------------
4 # Copyright (c) IPython Development Team.
5 # Copyright (C) 2008-2011 The IPython Development Team
5 # Distributed under the terms of the Modified BSD License.
6 #
7 # Distributed under the terms of the BSD License. The full license is in
8 # the file COPYING, distributed as part of this software.
9 #-----------------------------------------------------------------------------
10
11 #-----------------------------------------------------------------------------
12 # Imports
13 #-----------------------------------------------------------------------------
14
15 from __future__ import with_statement
16
6
17 import errno
7 import errno
18 import os
8 import os
@@ -611,6 +601,17 b' def test_unescape_glob():'
611 nt.assert_equals(path.unescape_glob(r'\a'), r'\a')
601 nt.assert_equals(path.unescape_glob(r'\a'), r'\a')
612
602
613
603
604 def test_ensure_dir_exists():
605 with TemporaryDirectory() as td:
606 d = os.path.join(td, u'∂ir')
607 path.ensure_dir_exists(d) # create it
608 assert os.path.isdir(d)
609 path.ensure_dir_exists(d) # no-op
610 f = os.path.join(td, u'ƒile')
611 open(f, 'w').close() # touch
612 with nt.assert_raises(IOError):
613 path.ensure_dir_exists(f)
614
614 class TestLinkOrCopy(object):
615 class TestLinkOrCopy(object):
615 def setUp(self):
616 def setUp(self):
616 self.tempdir = TemporaryDirectory()
617 self.tempdir = TemporaryDirectory()
General Comments 0
You need to be logged in to leave comments. Login now