summaryrefslogtreecommitdiff
path: root/tests/test_hashes.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_hashes.py')
-rw-r--r--tests/test_hashes.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_hashes.py b/tests/test_hashes.py
index e0aabe09..660373cb 100644
--- a/tests/test_hashes.py
+++ b/tests/test_hashes.py
@@ -82,11 +82,16 @@ class TestHashString(unittest.TestCase):
def setUp(self):
"""Prepare the test by reading the file."""
- self.hashes = apt_pkg.Hashes(open(apt_pkg.__file__))
+ self.file = open(apt_pkg.__file__)
+ self.hashes = apt_pkg.Hashes(self.file)
self.md5 = apt_pkg.HashString("MD5Sum", self.hashes.md5)
self.sha1 = apt_pkg.HashString("SHA1", self.hashes.sha1)
self.sha256 = apt_pkg.HashString("SHA256", self.hashes.sha256)
+ def tearDown(self):
+ """Cleanup, Close the file object used for the tests."""
+ self.file.close()
+
def test_md5(self):
"""hashes: Test apt_pkg.HashString().md5"""
self.assertEqual("MD5Sum:%s" % self.hashes.md5, str(self.md5))