@@ -400,10 +400,10 @@ def test_ignore(contents, exclude, tmpdir, git_env, monkeypatch):
400
400
401
401
repo_tar_path = os_path_join (tmpdir .strpath , 'repo.tar' )
402
402
repo .archive (repo_tar_path , exclude = exclude )
403
- repo_tar = TarFile (repo_tar_path , format = PAX_FORMAT , encoding = 'utf-8' )
404
403
405
- expected = make_expected_tree (contents , exclude )
406
- actual = make_actual_tree (repo_tar )
404
+ with TarFile (repo_tar_path , format = PAX_FORMAT , encoding = 'utf-8' ) as repo_tar :
405
+ expected = make_expected_tree (contents , exclude )
406
+ actual = make_actual_tree (repo_tar )
407
407
408
408
assert actual == expected
409
409
@@ -426,10 +426,10 @@ def test_cli(tmpdir, git_env, monkeypatch):
426
426
427
427
repo_tar_path = os_path_join (tmpdir .strpath , 'repo.tar' )
428
428
git_archive_all .main (['git_archive_all.py' , '--prefix' , '' , '-C' , repo_path , repo_tar_path ])
429
- repo_tar = TarFile (repo_tar_path , format = PAX_FORMAT , encoding = 'utf-8' )
430
429
431
- expected = make_expected_tree (contents )
432
- actual = make_actual_tree (repo_tar )
430
+ with TarFile (repo_tar_path , format = PAX_FORMAT , encoding = 'utf-8' ) as repo_tar :
431
+ expected = make_expected_tree (contents )
432
+ actual = make_actual_tree (repo_tar )
433
433
434
434
assert actual == expected
435
435
0 commit comments