summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest/tests/test_metadata_max_length.py
diff options
context:
space:
mode:
authorTrevor Gamblin <tgamblin@baylibre.com>2023-10-12 09:24:59 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-10-13 11:53:06 +0100
commitfd06e4f2664b69a2776cdc8188dba6e6e958d86a (patch)
tree2b26efe798c2169eeeea6e9c24ae5ac72d9fa9df /meta/lib/patchtest/tests/test_metadata_max_length.py
parent2fdabc368a52a9bf60f76f33e92b94de843688a8 (diff)
downloadpoky-fd06e4f2664b69a2776cdc8188dba6e6e958d86a.tar.gz
patchtest: clean up test suite
Various tweaks to make the test suite cleaner and more efficient: - Replace use of "re" module with "pyparsing" in tests (but not base.py) - Make test_mbox_cve only check for CVE tags in the commit if the added patch has them - Make test_mbox_cve SKIP instead of PASS if there's no CVE tag - Simplify the bugzilla tag checking test now that pyparsing is used - Modify the selftest script to correctly parse the new result output (From OE-Core rev: 7a187c2475aa762e2bc830950f608143f2535a72) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest/tests/test_metadata_max_length.py')
-rw-r--r--meta/lib/patchtest/tests/test_metadata_max_length.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/lib/patchtest/tests/test_metadata_max_length.py b/meta/lib/patchtest/tests/test_metadata_max_length.py
index b3a5dc9b79..477a9bff57 100644
--- a/meta/lib/patchtest/tests/test_metadata_max_length.py
+++ b/meta/lib/patchtest/tests/test_metadata_max_length.py
@@ -5,10 +5,10 @@
5# SPDX-License-Identifier: GPL-2.0 5# SPDX-License-Identifier: GPL-2.0
6 6
7import base 7import base
8import re 8import pyparsing
9 9
10class MaxLength(base.Base): 10class MaxLength(base.Base):
11 add_mark = re.compile('\+ ') 11 add_mark = pyparsing.Regex('\+ ')
12 max_length = 200 12 max_length = 200
13 13
14 def test_max_line_length(self): 14 def test_max_line_length(self):
@@ -18,7 +18,7 @@ class MaxLength(base.Base):
18 continue 18 continue
19 payload = str(patch) 19 payload = str(patch)
20 for line in payload.splitlines(): 20 for line in payload.splitlines():
21 if self.add_mark.match(line): 21 if self.add_mark.search_string(line):
22 current_line_length = len(line[1:]) 22 current_line_length = len(line[1:])
23 if current_line_length > self.max_length: 23 if current_line_length > self.max_length:
24 self.fail('Patch line too long (current length %s, maximum is %s)' % (current_line_length, self.max_length), 24 self.fail('Patch line too long (current length %s, maximum is %s)' % (current_line_length, self.max_length),