@@ -204,11 +204,11 @@ def is_sparse(fn, total_size, hole_size):
204204 sparse = False
205205 return sparse
206206
207- filename = os .path .join (archiver .input_path , "sparse" )
207+ filename_in = os .path .join (archiver .input_path , "sparse" )
208208 content = b"foobar"
209209 hole_size = 5 * (1 << CHUNK_MAX_EXP ) # 5 full chunker buffers
210210 total_size = hole_size + len (content ) + hole_size
211- with open (filename , "wb" ) as fd :
211+ with open (filename_in , "wb" ) as fd :
212212 # create a file that has a hole at the beginning and end (if the
213213 # OS and filesystem supports sparse files)
214214 fd .seek (hole_size , 1 )
@@ -217,7 +217,7 @@ def is_sparse(fn, total_size, hole_size):
217217 pos = fd .tell ()
218218 fd .truncate (pos )
219219 # we first check if we could create a sparse input file:
220- sparse_support = is_sparse (filename , total_size , hole_size )
220+ sparse_support = is_sparse (filename_in , total_size , hole_size )
221221 if sparse_support :
222222 # we could create a sparse input file, so creating a backup of it and
223223 # extracting it again (as sparse) should also work:
@@ -226,13 +226,15 @@ def is_sparse(fn, total_size, hole_size):
226226 with changedir (archiver .output_path ):
227227 cmd (archiver , "extract" , "test" , "--sparse" )
228228 assert_dirs_equal ("input" , "output/input" )
229- filename = os .path .join (archiver .output_path , "input" , "sparse" )
230- with open (filename , "rb" ) as fd :
229+ filename_out = os .path .join (archiver .output_path , "input" , "sparse" )
230+ with open (filename_out , "rb" ) as fd :
231231 # check if file contents are as expected
232232 assert fd .read (hole_size ) == b"\0 " * hole_size
233233 assert fd .read (len (content )) == content
234234 assert fd .read (hole_size ) == b"\0 " * hole_size
235- assert is_sparse (filename , total_size , hole_size )
235+ assert is_sparse (filename_out , total_size , hole_size )
236+ os .unlink (filename_out ) # save space on TMPDIR
237+ os .unlink (filename_in ) # save space on TMPDIR
236238
237239
238240def test_unusual_filenames (archivers , request ):
0 commit comments