summaryrefslogtreecommitdiffstats
path: root/meta/lib/patchtest/tests/test_mbox_bugzilla.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_mbox_bugzilla.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_mbox_bugzilla.py')
-rw-r--r--meta/lib/patchtest/tests/test_mbox_bugzilla.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/meta/lib/patchtest/tests/test_mbox_bugzilla.py b/meta/lib/patchtest/tests/test_mbox_bugzilla.py
index aa53b77f87..adf46b5d59 100644
--- a/meta/lib/patchtest/tests/test_mbox_bugzilla.py
+++ b/meta/lib/patchtest/tests/test_mbox_bugzilla.py
@@ -4,17 +4,17 @@
4# 4#
5# SPDX-License-Identifier: GPL-2.0 5# SPDX-License-Identifier: GPL-2.0
6 6
7import re 7import pyparsing
8import base 8import base
9 9
10class Bugzilla(base.Base): 10class Bugzilla(base.Base):
11 rexp_detect = re.compile("\[\s?YOCTO.*\]", re.IGNORECASE) 11 rexp_detect = pyparsing.Regex('\[\s?YOCTO.*\]')
12 rexp_validation = re.compile("\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]", re.IGNORECASE) 12 rexp_validation = pyparsing.Regex('\[(\s?YOCTO\s?#\s?(\d+)\s?,?)+\]')
13 13
14 def test_bugzilla_entry_format(self): 14 def test_bugzilla_entry_format(self):
15 for commit in Bugzilla.commits: 15 for commit in Bugzilla.commits:
16 for line in commit.commit_message.splitlines(): 16 if not self.rexp_detect.search_string(commit.commit_message):
17 if self.rexp_detect.match(line): 17 self.skip("No bug ID found")
18 if not self.rexp_validation.match(line): 18 elif not self.rexp_validation.search_string(commit.commit_message):
19 self.fail('Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', commit=commit) 19 self.fail('Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"', commit=commit)
20 20