diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2024-09-24 07:55:00 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-09-30 17:00:50 +0100 |
commit | 18a65c77c0e729dd1835852336e57ff4922f2674 (patch) | |
tree | 70809704cb1cfdc4cefc3d809438e6b990331830 /meta/lib/patchtest/tests/test_mbox.py | |
parent | d6ede9c73b44062d8831a08f522d519591bf29c2 (diff) | |
download | poky-18a65c77c0e729dd1835852336e57ff4922f2674.tar.gz |
patchtest: test_mbox: change ismerged -> canbemerged
The merge logic is a bit weird as-is. Remove the ismerged() method and
replace it where appropriate with canbemerged().
(From OE-Core rev: c5f5686f20b13d635a461d4cc353563f9c886f5f)
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.py')
-rw-r--r-- | meta/lib/patchtest/tests/test_mbox.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/meta/lib/patchtest/tests/test_mbox.py b/meta/lib/patchtest/tests/test_mbox.py index e6b8ad21f8..895ffde42b 100644 --- a/meta/lib/patchtest/tests/test_mbox.py +++ b/meta/lib/patchtest/tests/test_mbox.py | |||
@@ -43,7 +43,7 @@ class TestMbox(base.Base): | |||
43 | 43 | ||
44 | 44 | ||
45 | def test_signed_off_by_presence(self): | 45 | def test_signed_off_by_presence(self): |
46 | for commit in TestMbox.commits: | 46 | for commit in self.commits: |
47 | # skip those patches that revert older commits, these do not required the tag presence | 47 | # skip those patches that revert older commits, these do not required the tag presence |
48 | if patterns.mbox_revert_shortlog_regex.search_string(commit.shortlog): | 48 | if patterns.mbox_revert_shortlog_regex.search_string(commit.shortlog): |
49 | continue | 49 | continue |
@@ -52,7 +52,7 @@ class TestMbox(base.Base): | |||
52 | commit=commit) | 52 | commit=commit) |
53 | 53 | ||
54 | def test_shortlog_format(self): | 54 | def test_shortlog_format(self): |
55 | for commit in TestMbox.commits: | 55 | for commit in self.commits: |
56 | shortlog = commit.shortlog | 56 | shortlog = commit.shortlog |
57 | if not shortlog.strip(): | 57 | if not shortlog.strip(): |
58 | self.skip('Empty shortlog, no reason to execute shortlog format test') | 58 | self.skip('Empty shortlog, no reason to execute shortlog format test') |
@@ -67,7 +67,7 @@ class TestMbox(base.Base): | |||
67 | commit=commit) | 67 | commit=commit) |
68 | 68 | ||
69 | def test_shortlog_length(self): | 69 | def test_shortlog_length(self): |
70 | for commit in TestMbox.commits: | 70 | for commit in self.commits: |
71 | # no reason to re-check on revert shortlogs | 71 | # no reason to re-check on revert shortlogs |
72 | shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog) | 72 | shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog) |
73 | if shortlog.startswith('Revert "'): | 73 | if shortlog.startswith('Revert "'): |
@@ -79,22 +79,24 @@ class TestMbox(base.Base): | |||
79 | 79 | ||
80 | def test_series_merge_on_head(self): | 80 | def test_series_merge_on_head(self): |
81 | self.skip("Merge test is disabled for now") | 81 | self.skip("Merge test is disabled for now") |
82 | if PatchTestInput.repo.branch != "master": | 82 | if PatchTestInput.repo.patch.branch != "master": |
83 | self.skip("Skipping merge test since patch is not intended for master branch. Target detected is %s" % PatchTestInput.repo.branch) | 83 | self.skip( |
84 | if not PatchTestInput.repo.ismerged: | 84 | "Skipping merge test since patch is not intended" |
85 | " for master branch. Target detected is %s" | ||
86 | % PatchTestInput.repo.patch.branch | ||
87 | ) | ||
88 | if not PatchTestInput.repo.canbemerged: | ||
85 | commithash, author, date, shortlog = headlog() | 89 | commithash, author, date, shortlog = headlog() |
86 | self.fail('Series does not apply on top of target branch %s' % PatchTestInput.repo.branch, | 90 | self.fail('Series does not apply on top of target branch %s' % PatchTestInput.repo.branch, |
87 | data=[('Targeted branch', '%s (currently at %s)' % (PatchTestInput.repo.branch, commithash))]) | 91 | data=[('Targeted branch', '%s (currently at %s)' % (PatchTestInput.repo.branch, commithash))]) |
88 | 92 | ||
89 | def test_target_mailing_list(self): | 93 | def test_target_mailing_list(self): |
90 | """In case of merge failure, check for other targeted projects""" | 94 | """Check for other targeted projects""" |
91 | if PatchTestInput.repo.ismerged: | ||
92 | self.skip('Series merged, no reason to check other mailing lists') | ||
93 | 95 | ||
94 | # a meta project may be indicted in the message subject, if this is the case, just fail | 96 | # a meta project may be indicted in the message subject, if this is the case, just fail |
95 | # TODO: there may be other project with no-meta prefix, we also need to detect these | 97 | # TODO: there may be other project with no-meta prefix, we also need to detect these |
96 | project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]") | 98 | project_regex = pyparsing.Regex("\[(?P<project>meta-.+)\]") |
97 | for commit in TestMbox.commits: | 99 | for commit in self.commits: |
98 | match = project_regex.search_string(commit.subject) | 100 | match = project_regex.search_string(commit.subject) |
99 | if match: | 101 | if match: |
100 | self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', | 102 | self.fail('Series sent to the wrong mailing list or some patches from the series correspond to different mailing lists', |
@@ -122,7 +124,7 @@ class TestMbox(base.Base): | |||
122 | data=[('Diff line',self.unidiff_parse_error)]) | 124 | data=[('Diff line',self.unidiff_parse_error)]) |
123 | 125 | ||
124 | def test_commit_message_presence(self): | 126 | def test_commit_message_presence(self): |
125 | for commit in TestMbox.commits: | 127 | for commit in self.commits: |
126 | if not commit.commit_message.strip(): | 128 | if not commit.commit_message.strip(): |
127 | self.fail('Please include a commit message on your patch explaining the change', commit=commit) | 129 | self.fail('Please include a commit message on your patch explaining the change', commit=commit) |
128 | 130 | ||