Skip to content

Commit f000ee7

Browse files
committed
patchtest2/tests: move some from core to oe
core should have a very minimal set of tests for mbox format and basic guarantees around things such as signoffs. Signed-off-by: Trevor Gamblin <[email protected]>
1 parent 903f224 commit f000ee7

File tree

2 files changed

+32
-28
lines changed

2 files changed

+32
-28
lines changed

src/patchtest2/tests/core.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,34 +83,6 @@ def test_mbox_unidiff_parse_error(target):
8383

8484
return target.subject, result, reason
8585

86-
@patchtest_result
87-
def test_mbox_bugzilla_entry_format(target):
88-
"""Test for proper Bugzilla entry format in commit messages"""
89-
result = "PASS"
90-
reason = None
91-
92-
# Check if there's any bugzilla reference
93-
if not patterns.mbox_bugzilla.search_string(target.commit_message):
94-
result = "SKIP"
95-
reason = "No bug ID found"
96-
elif not patterns.mbox_bugzilla_validation.search_string(target.commit_message):
97-
result = "FAIL"
98-
reason = 'Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"'
99-
100-
return target.subject, result, reason
101-
102-
@patchtest_result
103-
def test_mbox_author_valid(target):
104-
"""Test for valid patch author"""
105-
result = "PASS"
106-
reason = f'Invalid author {target.author}. Resend the series with a valid patch author'
107-
108-
for invalid in patterns.invalid_submitters:
109-
if invalid.search_string(target.author):
110-
result = "FAIL"
111-
break
112-
113-
return target.subject, result, reason
11486

11587
@patchtest_result
11688
def test_mbox_revert_signed_off_by_exception(target):
@@ -129,6 +101,7 @@ def test_mbox_revert_signed_off_by_exception(target):
129101

130102
return target.subject, result, reason
131103

104+
132105
# Additional helper test that might be useful
133106
@patchtest_result
134107
def test_mbox_shortlog_revert_format(target):

src/patchtest2/tests/oe.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_mbox_commit_message_user_tags(target):
1515

1616
return target.subject, result, reason
1717

18+
1819
@patchtest_result
1920
def test_mbox_non_auh_upgrade(target):
2021
"""Test that patch is not from AUH (Auto Upgrade Helper)"""
@@ -26,6 +27,7 @@ def test_mbox_non_auh_upgrade(target):
2627

2728
return target.subject, result, reason
2829

30+
2931
@patchtest_result
3032
def test_mbox_target_mailing_list_meta_project(target):
3133
"""Check for meta-* project tags in subject line"""
@@ -39,3 +41,32 @@ def test_mbox_target_mailing_list_meta_project(target):
3941

4042
return target.subject, result, reason
4143

44+
45+
@patchtest_result
46+
def test_mbox_bugzilla_entry_format(target):
47+
"""Test for proper Bugzilla entry format in commit messages"""
48+
result = "PASS"
49+
reason = None
50+
51+
# Check if there's any bugzilla reference
52+
if not patterns.mbox_bugzilla.search_string(target.commit_message):
53+
result = "SKIP"
54+
reason = "No bug ID found"
55+
elif not patterns.mbox_bugzilla_validation.search_string(target.commit_message):
56+
result = "FAIL"
57+
reason = 'Bugzilla issue ID is not correctly formatted - specify it with format: "[YOCTO #<bugzilla ID>]"'
58+
59+
return target.subject, result, reason
60+
61+
@patchtest_result
62+
def test_mbox_author_valid(target):
63+
"""Test for valid patch author"""
64+
result = "PASS"
65+
reason = f'Invalid author {target.author}. Resend the series with a valid patch author'
66+
67+
for invalid in patterns.invalid_submitters:
68+
if invalid.search_string(target.author):
69+
result = "FAIL"
70+
break
71+
72+
return target.subject, result, reason

0 commit comments

Comments
 (0)