From 0730a57db438b935bc7f16957650a6ef25589598 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 31 Dec 2017 16:40:21 +0100 Subject: patch_series: Don't fail on decoding errors when looking for DEP3 headers Closes: #885929 --- tests/08_test_patch.py | 16 +++++++++++++++- tests/08_test_patch_data/dep3-iso8859-1.patch | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/08_test_patch_data/dep3-iso8859-1.patch (limited to 'tests') diff --git a/tests/08_test_patch.py b/tests/08_test_patch.py index bc9a507c..3ed16eba 100644 --- a/tests/08_test_patch.py +++ b/tests/08_test_patch.py @@ -7,7 +7,7 @@ from . import context # noqa: 401 import os import unittest -from gbp.patch_series import Patch +from gbp.patch_series import Patch, Dep3Patch class TestPatch(unittest.TestCase): @@ -38,3 +38,17 @@ class TestPatch(unittest.TestCase): "It can span several lines.\n", p.long_desc) self.assertEqual('Sat, 24 Dec 2011 12:05:53 +0100', p.date) + + +class TestDep3Patch(unittest.TestCase): + data_dir = os.path.splitext(__file__)[0] + '_data' + + def test_encoding(self): + """Make sure broken encoding does no affect import""" + patchfile = os.path.join(self.data_dir, "dep3-iso8859-1.patch") + self.assertTrue(os.path.exists(patchfile)) + p = Dep3Patch(patchfile) + self.assertEqual('Replace all -- in man page by \-\- to make lintian happy.', p.subject) + self.assertEqual("Roland Rosenfeld", p.author) + self.assertEqual("roland@debian.org", p.email) + self.assertEqual("", p.long_desc) diff --git a/tests/08_test_patch_data/dep3-iso8859-1.patch b/tests/08_test_patch_data/dep3-iso8859-1.patch new file mode 100644 index 00000000..518ce556 --- /dev/null +++ b/tests/08_test_patch_data/dep3-iso8859-1.patch @@ -0,0 +1,15 @@ +Author: Roland Rosenfeld +Description: Replace all -- in man page by \-\- to make lintian happy. + +--- a/GNUmakefile.in ++++ b/GNUmakefile.in +@@ -484,8 +484,7 @@ man: dok-release + perl -pi.bak -e "s/\[ /\[/g;s/á/\\\\['a]/g;s/é/\\\\['e]/g" $(MAN_PAGE); \ + perl -pi.bak -e "s/ö/\\\\[:o]/g" $(MAN_PAGE); \ + perl -pi.bak -e 's/([ {])-([a-z])/$$1\\-$$2/g' $(MAN_PAGE); \ +- perl -pi.bak -e 's/ --([a-z])/ \\-\\-$$1/g' $(MAN_PAGE); \ +- perl -pi.bak -e 's/\\fB--/\\fB\\-\\-/g' $(MAN_PAGE); \ ++ perl -pi.bak -e 's/--/\\-\\-/g' $(MAN_PAGE); \ + $(DB) ../privoxy-man-page.sgml && $(MV) -f $(MAN_PAGE) ../../../$(MAN_PAGE) + + # For those with man2html ala RH7s. -- cgit v1.2.3