@@ -1516,6 +1516,7 @@ def test_misbehaved_io_read(self):
1516
1516
def test_garbage_collection (self ):
1517
1517
# C BufferedReader objects are collected.
1518
1518
# The Python version has __del__, so it ends into gc.garbage instead
1519
+ self .addCleanup (support .unlink , support .TESTFN )
1519
1520
with support .check_warnings (('' , ResourceWarning )):
1520
1521
rawio = self .FileIO (support .TESTFN , "w+b" )
1521
1522
f = self .tp (rawio )
@@ -1718,6 +1719,7 @@ def test_destructor(self):
1718
1719
1719
1720
def test_truncate (self ):
1720
1721
# Truncate implicitly flushes the buffer.
1722
+ self .addCleanup (support .unlink , support .TESTFN )
1721
1723
with self .open (support .TESTFN , self .write_mode , buffering = 0 ) as raw :
1722
1724
bufio = self .tp (raw , 8 )
1723
1725
bufio .write (b"abcdef" )
@@ -1730,6 +1732,7 @@ def test_truncate_after_write(self):
1730
1732
# Ensure that truncate preserves the file position after
1731
1733
# writes longer than the buffer size.
1732
1734
# Issue: https://bugs.python.org/issue32228
1735
+ self .addCleanup (support .unlink , support .TESTFN )
1733
1736
with self .open (support .TESTFN , "wb" ) as f :
1734
1737
# Fill with some buffer
1735
1738
f .write (b'\x00 ' * 10000 )
@@ -1851,6 +1854,7 @@ def test_garbage_collection(self):
1851
1854
# C BufferedWriter objects are collected, and collecting them flushes
1852
1855
# all data to disk.
1853
1856
# The Python version has __del__, so it ends into gc.garbage instead
1857
+ self .addCleanup (support .unlink , support .TESTFN )
1854
1858
with support .check_warnings (('' , ResourceWarning )):
1855
1859
rawio = self .FileIO (support .TESTFN , "w+b" )
1856
1860
f = self .tp (rawio )
0 commit comments