Remove cleanup_tempfiles altogether because they are not being used

This commit is contained in:
Micah Lee 2022-02-13 10:40:55 -08:00
parent 33fd639f2a
commit 305abff13c
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 0 additions and 13 deletions

View File

@ -201,9 +201,6 @@ class SendBaseModeWeb:
self._gzip_compress(filesystem_path, gzip_filename, 6, None)
self.gzip_individual_files[filesystem_path] = gzip_filename
# Cleanup this temp file
self.web.cleanup_tempfiles.append(gzip_filename)
file_to_download = self.gzip_individual_files[filesystem_path]
filesize = os.path.getsize(self.gzip_individual_files[filesystem_path])
else:

View File

@ -171,7 +171,6 @@ class Web:
self.socketio.init_app(self.app)
self.chat_mode = ChatModeWeb(self.common, self)
self.cleanup_tempfiles = []
self.cleanup_tempdirs = []
def get_mode(self):
@ -405,13 +404,8 @@ class Web:
"""
self.common.log("Web", "cleanup")
# Close all of the tempfile.NamedTemporaryFile
for file in self.cleanup_tempfiles:
file.close()
# Clean up the tempfile.NamedTemporaryDirectory objects
for dir in self.cleanup_tempdirs:
dir.cleanup()
self.cleanup_tempfiles = []
self.cleanup_tempdirs = []

View File

@ -308,17 +308,13 @@ class TestWeb:
def test_cleanup(self, common_obj, temp_dir_1024):
web = web_obj(temp_dir_1024, common_obj, "share", 3)
temp_file = tempfile.NamedTemporaryFile()
temp_dir = tempfile.TemporaryDirectory()
web.cleanup_tempfiles = [temp_file]
web.cleanup_tempdirs = [temp_dir]
web.cleanup()
assert os.path.exists(temp_file.name) is False
assert os.path.exists(temp_dir.name) is False
assert web.cleanup_tempfiles == []
assert web.cleanup_tempdirs == []