Package: python-apt Version: 0.9.4 Severity: normal Tags: patch During the python unit tests phase of the build process the following warning is emitted:
/usr/lib/python3.4/unittest/case.py:577: ResourceWarning: unclosed file <_io.TextIOWrapper name=66 mode='r' encoding='UTF-8'> testMethod() In tests/test_tagfile.py two files are opened and not closed. This is the reason of this warning. The attached patch correct this problem.
>From 34271f1ccf34d134fa050d30ae23af634221a774 Mon Sep 17 00:00:00 2001 From: von <mat...@mailoo.org> Date: Fri, 15 May 2015 01:10:14 +0200 Subject: [PATCH] Fix warning emitted during python unit tests --- tests/test_tagfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py index 1ac2062..203ad5a 100644 --- a/tests/test_tagfile.py +++ b/tests/test_tagfile.py @@ -36,6 +36,7 @@ class TestOpenMaybeClearSigned(unittest.TestCase): os.path.join(basepath, "./data/test_debs/hello_2.5-1.dsc")) f = os.fdopen(fd) data = f.read() + f.close() self.assertTrue(data.startswith("Format: 1.0\n")) def test_open_normal(self): @@ -44,6 +45,7 @@ class TestOpenMaybeClearSigned(unittest.TestCase): os.path.join(basepath, "./data/misc/foo_Release")) f = os.fdopen(fd) data = f.read() + f.close() self.assertTrue(data.startswith("Origin: Ubuntu\n")) def xtest_open_does_not_exit(self): -- 2.1.4