fix handling of asserts for python3

This commit is contained in:
Gregory Becker
2020-03-27 15:39:44 -07:00
committed by Tamara Dahlgren
parent 3229bf04f5
commit d92f52ae02
2 changed files with 5 additions and 2 deletions

View File

@@ -22,10 +22,12 @@ def re_raise(e, exc_info=None):
# construct arguments to re-raise error from type
args = []
if hasattr(e, 'message'):
if hasattr(e, 'args'):
args.extend(e.args)
if hasattr(e, 'message') and e.message not in e.args:
args.append(e.message)
if hasattr(e, 'long_message'):
args.append(e.long_message)
args.append(str(e.long_message))
if sys.version_info[0] < 3:
# ugly hack: exec to avoid the fact this is a syntax

View File

@@ -88,6 +88,7 @@ def test_test_output_on_failure(mock_packages, mock_archive, mock_fetch,
out = spack_test('test-fail', fail_on_error=False)
assert "Expected 'not in the output' in output of `true`" in out
assert "AssertionError:" in out
def test_show_log_on_error(mock_packages, mock_archive, mock_fetch,