Skip to content

Commit

Permalink
fixing reporting of other errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jonrkarr committed Jun 26, 2020
1 parent 64c8664 commit 51bdb5d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion karr_lab_build_utils/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ def _default(self):
print('No notifications were sent.')

if status['is_other_error']:
raise SystemExit('Post-test tasks were not successful') from other_exception
raise SystemExit('Post-test tasks were not successful: {}'.format(
other_exception['exception'])).with_traceback(other_exception['traceback'])


class MakeAndArchiveReportsController(cement.Controller):
Expand Down
5 changes: 3 additions & 2 deletions karr_lab_build_utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ def do_post_test_tasks(self, installation_error, tests_error, dry_run=False):
:obj:`dict` of :obj:`str`, :obj:`str`: dictionary which maps names of untriggered packages to the reasons
why they weren't triggered
:obj:`dict`: status of a set of results
:obj:`Exception`: exception from `make_and_archive_reports`
:obj:`dict`: exception from `make_and_archive_reports`
"""
try:
static_analyses = self.make_and_archive_reports(dry_run=dry_run)
Expand All @@ -1718,7 +1718,8 @@ def do_post_test_tasks(self, installation_error, tests_error, dry_run=False):
except Exception as exception:
static_analyses = {'missing_requirements': [], 'unused_requirements': []}
other_error = True
other_exception = exception
other_exception = {'exception': exception}
_, _, other_exception['traceback'] = sys.exc_info()

triggered_packages, not_triggered_packages = self.trigger_tests_of_downstream_dependencies(dry_run=dry_run)
status = self.send_email_notifications(installation_error, tests_error, other_error, static_analyses, dry_run=dry_run)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def test_do_post_test_tasks(self):
'is_other_error': True,
'is_new_downstream_error': True,
}
with mock.patch.object(core.BuildHelper, 'make_and_archive_reports', return_value=None):
with mock.patch.object(core.BuildHelper, 'make_and_archive_reports', side_effect=Exception('Another error')):
with mock.patch.object(core.BuildHelper, 'trigger_tests_of_downstream_dependencies', return_value=down_pkgs_return):
with mock.patch.object(core.BuildHelper, 'send_email_notifications', return_value=notify_return):
with self.construct_environment():
Expand Down

0 comments on commit 51bdb5d

Please sign in to comment.