Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store tempfile objects to prevent deletion during tests #555

Merged
merged 1 commit into from Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/units/test_archive.rb
Expand Up @@ -7,10 +7,16 @@ class TestArchive < Test::Unit::TestCase
def setup
set_file_paths
@git = Git.open(@wdir)
@tempfiles = []
end

def teardown
@tempfiles.clear
end

def tempfile
tempfile_object = Tempfile.new('archive-test')
@tempfiles << tempfile_object # prevent deletion until teardown
tempfile_object.close # close to avoid locking from git processes
tempfile_object.path
end
Expand Down