Open file with write mode

This commit is contained in:
xuzg 2017-12-02 16:20:00 +08:00
parent cb28914589
commit a58d48209a
1 changed files with 5 additions and 5 deletions

View File

@ -140,7 +140,7 @@ class Testlink():
def test_link_a_file(self, tmpdir):
file = str(tmpdir.join('test.txt'))
link_file = str(tmpdir.join('test.link'))
open(file)
open(file, 'w')
link(file, link_file)
assert os.path.exists(link_file)
@ -215,7 +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'))
open(f)
open(f, 'w')
os.symlink(f, link_f)
copy(d, d_copy, follow_symlinks=True)
assert os.path.exists(d_copy)
@ -229,7 +229,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'))
open(f)
open(f, 'w')
os.symlink(f, link_f)
copy(d, d_copy)
assert os.path.exists(d_copy)
@ -241,7 +241,7 @@ class Testcopy():
file = str(tmpdir.join('test.txt'))
link_file = str(tmpdir.join('test.link'))
copy_link_file = str(tmpdir.join('test_copy.link'))
open(file)
open(file, 'w')
link(file, link_file)
copy(link_file, copy_link_file,follow_symlinks=True)
assert os.path.exists(copy_link_file)
@ -253,7 +253,7 @@ class Testcopy():
file = str(tmpdir.join('test.txt'))
link_file = str(tmpdir.join('test.link'))
copy_link_file = str(tmpdir.join('test_copy.link'))
open(file)
open(file, 'w')
link(file, link_file)
copy(link_file, copy_link_file, follow_symlinks=False)
assert os.path.exists(copy_link_file)