Skip to content

Commit

Permalink
main: Report "no action" verbosely even if no sanity-check status
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Górny <mgorny@gentoo.org>
  • Loading branch information
mgorny committed Jul 29, 2021
1 parent 051c8e6 commit 51ea74c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
14 changes: 4 additions & 10 deletions nattka/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -756,18 +756,17 @@ def sanity_check(self) -> int:
continue
except KeywordNotSpecified:
log.info('Skipping because of incomplete keywords')
comment = ('Resetting sanity check; keywords are '
'not fully specified and arches are not '
'CC-ed.')
comment = ('Keywords are not fully specified and '
'arches are not CC-ed.')
assert check_res is None
except PackageListDoneAlready:
# do not update bug status if done already
log.info('Skipping, work done already')
continue
except PackageListEmpty:
log.info('Skipping because of empty package list')
comment = ('Resetting sanity check; package list '
'is empty or all packages are done.')
comment = ('Package list is empty or all packages '
'have requested keywords.')
assert check_res is None
except (PackageMatchException, DependentBugError) as e:
log.error(e)
Expand All @@ -786,11 +785,6 @@ def sanity_check(self) -> int:
f'{git_repo.path}: working tree is dirty')
raise SystemExit(1)

# if we can not check it, and it's not been marked
# as checked, just skip it; otherwise, reset the flag
if check_res is None and b.sanity_check is None:
continue

# truncate comment if necessary
if (comment is not None
and len(comment) >= BUGZILLA_MAX_COMMENT_LEN):
Expand Down
24 changes: 6 additions & 18 deletions test/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def get_package(self,
class IntegrationNoActionTests(IntegrationTestCase):
"""Test cases for bugs that can not be processed"""

reset_msg = ('Resetting sanity check; package list is empty '
'or all packages are done.')
reset_msg = ('Package list is empty or all packages have requested '
'keywords.')

def bug_preset(self,
bugz: MagicMock,
Expand Down Expand Up @@ -118,18 +118,6 @@ def test_apply_empty_package_list(self, bugz, add_keywords):
cc=FULL_CC)
add_keywords.assert_not_called()

@patch('nattka.__main__.add_keywords')
@patch('nattka.__main__.NattkaBugzilla')
def test_sanity_empty_package_list(self, bugz, add_keywords):
bugz_inst = self.bug_preset(bugz)
self.assertEqual(
main(self.common_args + ['sanity-check', '--update-bugs',
'560322']),
0)
bugz_inst.find_bugs.assert_called_with(bugs=[560322])
add_keywords.assert_not_called()
bugz_inst.update_status.assert_not_called()

@patch('nattka.__main__.add_keywords')
@patch('nattka.__main__.NattkaBugzilla')
def test_sanity_reset_n(self, bugz, add_keywords):
Expand Down Expand Up @@ -196,8 +184,8 @@ def test_sanity_empty_keywords(self, bugz, add_keywords):
bugz_inst.find_bugs.assert_called_with(bugs=[560322])
add_keywords.assert_not_called()
bugz_inst.update_status.assert_called_with(
560322, None, 'Resetting sanity check; keywords are not '
'fully specified and arches are not CC-ed.')
560322, None, 'Keywords are not fully specified and arches '
'are not CC-ed.')

@patch('nattka.__main__.add_keywords')
@patch('nattka.__main__.NattkaBugzilla')
Expand All @@ -221,8 +209,8 @@ def test_sanity_empty_keywords_cc_arches(self, bugz, add_keywords):
bugz_inst.find_bugs.assert_called_with(bugs=[560322])
add_keywords.assert_not_called()
bugz_inst.update_status.assert_called_with(
560322, None, 'Resetting sanity check; keywords are not '
'fully specified and arches are not CC-ed.')
560322, None, 'Keywords are not fully specified and arches '
'are not CC-ed.')

def wrong_category_preset(self,
bugz: MagicMock
Expand Down

0 comments on commit 51ea74c

Please sign in to comment.