2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

Ensure opened files are closed.

This commit is contained in:
Mark Grassi
2022-06-18 14:40:58 -04:00
parent d7e3f33aa8
commit bf819bc8e6
6 changed files with 77 additions and 56 deletions

View File

@@ -114,14 +114,13 @@ Feb 4 13:40:38 XPS-13-9370 kernel: [128552.880347] audit: type=1400 audit({epoc
handle, self.test_logfile = tempfile.mkstemp(prefix='test-aa-notify-')
os.close(handle)
handle = open(self.test_logfile, "w+")
handle.write(
test_logfile_contents_999_days_old +
test_logfile_contents_30_days_old +
test_logfile_contents_unrelevant_entries +
test_logfile_contents_0_seconds_old
)
handle.close()
with open(self.test_logfile, "w+") as handle:
handle.write(
test_logfile_contents_999_days_old +
test_logfile_contents_30_days_old +
test_logfile_contents_unrelevant_entries +
test_logfile_contents_0_seconds_old
)
def AATeardown(self):
'''Remove temporary log file after tests ended'''