diff options
| author | Julian Andres Klode <jak@debian.org> | 2011-04-06 11:15:47 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2011-04-06 11:15:47 +0200 |
| commit | 5ad927a38cad08a2d79f327e7bb3cc46316fa6a4 (patch) | |
| tree | 0ad729e5abaeaa66923883251587695ea2e4c00c /tests/test_hashes.py | |
| parent | b766dc001aeea1c18b0c17c1d5029673ef539ef0 (diff) | |
| download | python-apt-5ad927a38cad08a2d79f327e7bb3cc46316fa6a4.tar.gz | |
all: Fix all instances of ResourceWarning about unclosed files
Diffstat (limited to 'tests/test_hashes.py')
| -rw-r--r-- | tests/test_hashes.py | 7 |
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)) |
