Skip to content

Commit 202b031

Browse files
committed
Update the error output in the .csv file of nosetest reports
1 parent 851bccb commit 202b031

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

seleniumbase/core/report_helper.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ def process_failures(test, test_count, browser_type, duration):
5353
file.write(test._last_page_screenshot)
5454
page_actions.save_test_failure_data(
5555
test.driver, bad_page_data, browser_type, folder=LATEST_REPORT_DIR)
56-
exc_info = '(Unknown Failure)'
57-
exception = sys.exc_info()[1]
58-
if exception:
59-
if hasattr(exception, 'msg'):
60-
exc_info = exception.msg
61-
elif hasattr(exception, 'message'):
62-
exc_info = exception.message
63-
else:
64-
pass
56+
exc_message = None
57+
if sys.version_info[0] >= 3 and hasattr(test, '_outcome') and (
58+
hasattr(test._outcome, 'errors') and test._outcome.errors):
59+
try:
60+
exc_message = test._outcome.errors[0][1][1]
61+
except Exception:
62+
exc_message = "(Unknown Exception)"
63+
else:
64+
try:
65+
exc_message = sys.last_value
66+
except Exception:
67+
exc_message = "(Unknown Exception)"
6568
return(
6669
'"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"' % (
6770
test_count,
@@ -73,7 +76,7 @@ def process_failures(test, test_count, browser_type, duration):
7376
get_timestamp()[:-3],
7477
duration,
7578
test.id(),
76-
exc_info))
79+
exc_message))
7780

7881

7982
def clear_out_old_report_logs(archive_past_runs=True, get_log_folder=False):

0 commit comments

Comments
 (0)