Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 88b215e

Browse files
committed
Issue #21440: test_zipfile: replace last direct calls to os.remove() with
support.unlink()
1 parent 57004c6 commit 88b215e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Lib/test/test_zipfile.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def test_write_non_pyfile(self):
717717
with open(TESTFN, 'w') as f:
718718
f.write('most definitely not a python file')
719719
self.assertRaises(RuntimeError, zipfp.writepy, TESTFN)
720-
os.remove(TESTFN)
720+
unlink(TESTFN)
721721

722722
def test_write_pyfile_bad_syntax(self):
723723
os.mkdir(TESTFN2)
@@ -763,7 +763,7 @@ def test_extract(self):
763763
with open(writtenfile, "rb") as f:
764764
self.assertEqual(fdata.encode(), f.read())
765765

766-
os.remove(writtenfile)
766+
unlink(writtenfile)
767767

768768
# remove the test file subdirectories
769769
rmtree(os.path.join(os.getcwd(), 'ziptest2dir'))
@@ -781,7 +781,7 @@ def test_extract_all(self):
781781
with open(outfile, "rb") as f:
782782
self.assertEqual(fdata.encode(), f.read())
783783

784-
os.remove(outfile)
784+
unlink(outfile)
785785

786786
# remove the test file subdirectories
787787
rmtree(os.path.join(os.getcwd(), 'ziptest2dir'))
@@ -887,7 +887,7 @@ def _test_extract_hackers_arcnames(self, hacknames):
887887
self.check_file(correctfile, content)
888888
rmtree(fixedname.split('/')[0])
889889

890-
os.remove(TESTFN2)
890+
unlink(TESTFN2)
891891

892892

893893
class OtherTests(unittest.TestCase):
@@ -1755,7 +1755,7 @@ def test_iterlines(self):
17551755

17561756
def tearDown(self):
17571757
for sep, fn in self.arcfiles.items():
1758-
os.remove(fn)
1758+
unlink(fn)
17591759
unlink(TESTFN)
17601760
unlink(TESTFN2)
17611761

0 commit comments

Comments
 (0)