mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-01 07:50:38 +00:00
sepolgen: Close files after reading/writing in tests.
Signed-off-by: Robert Kuska <rkuska@redhat.com>
This commit is contained in:
parent
15a7553d22
commit
a9fb9053f7
@ -166,6 +166,7 @@ class TestAuditParser(unittest.TestCase):
|
|||||||
f = open("audit.txt")
|
f = open("audit.txt")
|
||||||
a = sepolgen.audit.AuditParser()
|
a = sepolgen.audit.AuditParser()
|
||||||
a.parse_file(f)
|
a.parse_file(f)
|
||||||
|
f.close()
|
||||||
self.assertEqual(len(a.avc_msgs), 21)
|
self.assertEqual(len(a.avc_msgs), 21)
|
||||||
self.assertEqual(len(a.compute_sid_msgs), 0)
|
self.assertEqual(len(a.compute_sid_msgs), 0)
|
||||||
self.assertEqual(len(a.invalid_msgs), 0)
|
self.assertEqual(len(a.invalid_msgs), 0)
|
||||||
|
@ -268,6 +268,7 @@ class TestInterfaceSet(unittest.TestCase):
|
|||||||
i2 = interfaces.InterfaceSet()
|
i2 = interfaces.InterfaceSet()
|
||||||
f = open("output")
|
f = open("output")
|
||||||
i2.from_file(f)
|
i2.from_file(f)
|
||||||
|
f.close()
|
||||||
if_status = [False, False, False]
|
if_status = [False, False, False]
|
||||||
for ifv in i2.interfaces.values():
|
for ifv in i2.interfaces.values():
|
||||||
if ifv.name == "files_search_usr":
|
if ifv.name == "files_search_usr":
|
||||||
|
@ -25,6 +25,7 @@ class TestInfoFlow(unittest.TestCase):
|
|||||||
info = sepolgen.objectmodel.PermMappings()
|
info = sepolgen.objectmodel.PermMappings()
|
||||||
fd = open("perm_map")
|
fd = open("perm_map")
|
||||||
info.from_file(fd)
|
info.from_file(fd)
|
||||||
|
fd.close()
|
||||||
|
|
||||||
pm = info.get("filesystem", "mount")
|
pm = info.get("filesystem", "mount")
|
||||||
self.assertEqual(pm.perm, "mount")
|
self.assertEqual(pm.perm, "mount")
|
||||||
|
Loading…
Reference in New Issue
Block a user