diff --git a/IPython/utils/tests/test_path.py b/IPython/utils/tests/test_path.py index 4fe0b32..8d50f17 100644 --- a/IPython/utils/tests/test_path.py +++ b/IPython/utils/tests/test_path.py @@ -1,18 +1,8 @@ # encoding: utf-8 """Tests for IPython.utils.path.py""" -#----------------------------------------------------------------------------- -# Copyright (C) 2008-2011 The IPython Development Team -# -# Distributed under the terms of the BSD License. The full license is in -# the file COPYING, distributed as part of this software. -#----------------------------------------------------------------------------- - -#----------------------------------------------------------------------------- -# Imports -#----------------------------------------------------------------------------- - -from __future__ import with_statement +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. import errno import os @@ -611,6 +601,17 @@ def test_unescape_glob(): nt.assert_equals(path.unescape_glob(r'\a'), r'\a') +def test_ensure_dir_exists(): + with TemporaryDirectory() as td: + d = os.path.join(td, u'∂ir') + path.ensure_dir_exists(d) # create it + assert os.path.isdir(d) + path.ensure_dir_exists(d) # no-op + f = os.path.join(td, u'ƒile') + open(f, 'w').close() # touch + with nt.assert_raises(IOError): + path.ensure_dir_exists(f) + class TestLinkOrCopy(object): def setUp(self): self.tempdir = TemporaryDirectory()