aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-12-31 16:40:21 +0100
committerGuido Günther <agx@sigxcpu.org>2017-12-31 16:46:48 +0100
commit0730a57db438b935bc7f16957650a6ef25589598 (patch)
tree622f8dd3bc2684f7f60483ea402398500e807084 /tests
parent7b0660abab858938330553a1379df57b2a9b851b (diff)
patch_series: Don't fail on decoding errors when looking for DEP3 headers
Closes: #885929
Diffstat (limited to 'tests')
-rw-r--r--tests/08_test_patch.py16
-rw-r--r--tests/08_test_patch_data/dep3-iso8859-1.patch15
2 files changed, 30 insertions, 1 deletions
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 <roland@debian.org>
+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.