I just ran across this bug too, but not until I worked out a different
patch. ;)
I'd be fine with Neil's patch, or deleting the test entirely. In the
attached, I only assert that the SystemError is raised, but not what the
exception message is.
The other change is to close a small (possibly only theoretical) hole which
could leak the temporary file. Ideally, this should probably use a
with-statement and tempfile.NamedTemporaryFile.
diff --git a/tests/test_deb822.py b/tests/test_deb822.py
index 698366b..33c569d 100755
--- a/tests/test_deb822.py
+++ b/tests/test_deb822.py
@@ -911,16 +911,17 @@ Description: python modules to work with Debian-related data formats
See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750247#35
"""
- fd, filename = tempfile.mkstemp()
- fp = os.fdopen(fd, 'wb')
- fp.write(UNPARSED_PARAGRAPHS_WITH_COMMENTS.encode('utf-8'))
- fp.close()
-
try:
+ fd, filename = tempfile.mkstemp()
+ fp = os.fdopen(fd, 'wb')
+ fp.write(UNPARSED_PARAGRAPHS_WITH_COMMENTS.encode('utf-8'))
+ fp.close()
+
with open_utf8(filename) as fh:
- paragraphs = list(deb822.Deb822.iter_paragraphs(
- fh, use_apt_pkg=True))
- self.assertEqual(paragraphs[0]['Build-Depends'], 'debhelper,')
+ self.assertRaises(SystemError,
+ list,
+ deb822.Deb822.iter_paragraphs(
+ fh, use_apt_pkg=True))
finally:
os.remove(filename)
--
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-python-debian-maint