makedir before open an not exist file

This commit is contained in:
xuzg 2017-12-02 16:26:34 +08:00
parent a58d48209a
commit fd0965e02f
1 changed files with 3 additions and 1 deletions

View File

@ -215,6 +215,7 @@ class Testcopy():
link_f = str(tmpdir.join('test/test_link.txt'))
d_copy = str(tmpdir.join('test_copy'))
new_link_f = str(tmpdir.join('test_copy/test_link.txt'))
makedirs(d)
open(f, 'w')
os.symlink(f, link_f)
copy(d, d_copy, follow_symlinks=True)
@ -229,6 +230,7 @@ class Testcopy():
link_f = str(tmpdir.join('test/test_link.txt'))
d_copy = str(tmpdir.join('test_copy'))
new_link_f = str(tmpdir.join('test_copy/test_link.txt'))
makedirs(d)
open(f, 'w')
os.symlink(f, link_f)
copy(d, d_copy)
@ -243,7 +245,7 @@ class Testcopy():
copy_link_file = str(tmpdir.join('test_copy.link'))
open(file, 'w')
link(file, link_file)
copy(link_file, copy_link_file,follow_symlinks=True)
copy(link_file, copy_link_file, follow_symlinks=True)
assert os.path.exists(copy_link_file)
assert not os.path.islink(copy_link_file)