mirror of https://github.com/python/cpython
Merged revisions 76103 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r76103 | antoine.pitrou | 2009-11-04 01:57:15 +0100 (mer., 04 nov. 2009) | 9 lines Merged revisions 76101 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r76101 | antoine.pitrou | 2009-11-04 01:50:26 +0100 (mer., 04 nov. 2009) | 3 lines Make test_shutil clean up after itself ........ ................
This commit is contained in:
parent
d6fcd562bf
commit
2bb246ac12
|
@ -118,7 +118,7 @@ class TestShutil(unittest.TestCase):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
for path in (src_dir,
|
for path in (src_dir,
|
||||||
os.path.abspath(os.path.join(dst_dir, os.path.pardir))
|
os.path.dirname(dst_dir)
|
||||||
):
|
):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
@ -140,6 +140,7 @@ class TestShutil(unittest.TestCase):
|
||||||
join = os.path.join
|
join = os.path.join
|
||||||
exists = os.path.exists
|
exists = os.path.exists
|
||||||
src_dir = tempfile.mkdtemp()
|
src_dir = tempfile.mkdtemp()
|
||||||
|
try:
|
||||||
dst_dir = join(tempfile.mkdtemp(), 'destination')
|
dst_dir = join(tempfile.mkdtemp(), 'destination')
|
||||||
write_data(join(src_dir, 'test.txt'), '123')
|
write_data(join(src_dir, 'test.txt'), '123')
|
||||||
write_data(join(src_dir, 'test.tmp'), '123')
|
write_data(join(src_dir, 'test.tmp'), '123')
|
||||||
|
@ -199,6 +200,9 @@ class TestShutil(unittest.TestCase):
|
||||||
finally:
|
finally:
|
||||||
if os.path.exists(dst_dir):
|
if os.path.exists(dst_dir):
|
||||||
shutil.rmtree(dst_dir)
|
shutil.rmtree(dst_dir)
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(src_dir)
|
||||||
|
shutil.rmtree(os.path.dirname(dst_dir))
|
||||||
|
|
||||||
if hasattr(os, "symlink"):
|
if hasattr(os, "symlink"):
|
||||||
def test_dont_copy_file_onto_link_to_itself(self):
|
def test_dont_copy_file_onto_link_to_itself(self):
|
||||||
|
|
Loading…
Reference in New Issue