Skip to content

Commit af9b768

Browse files
committed
Fix delayed asserts.
1 parent 99abc63 commit af9b768

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

seleniumbase/fixtures/base_case.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,23 +2520,13 @@ def __get_exception_message(self):
25202520
""" This method extracts the message from an exception if there
25212521
was an exception that occurred during the test, assuming
25222522
that the exception was in a try/except block and not thrown. """
2523-
if sys.version.startswith('3') and hasattr(self, '_outcome'):
2524-
exception_info = self._outcome.errors
2525-
if exception_info:
2526-
try:
2527-
exc_message = exception_info[0][1][1]
2528-
except Exception:
2529-
exc_message = "(Unknown Exception)"
2530-
else:
2531-
exc_message = "(Unknown Exception)"
2523+
exception_info = sys.exc_info()[1]
2524+
if hasattr(exception_info, 'msg'):
2525+
exc_message = exception_info.msg
2526+
elif hasattr(exception_info, 'message'):
2527+
exc_message = exception_info.message
25322528
else:
2533-
exception_info = sys.exc_info()[1]
2534-
if hasattr(exception_info, 'msg'):
2535-
exc_message = exception_info.msg
2536-
elif hasattr(exception_info, 'message'):
2537-
exc_message = exception_info.message
2538-
else:
2539-
exc_message = '(Unknown Exception)'
2529+
exc_message = '(Unknown Exception)'
25402530
return exc_message
25412531

25422532
def __get_improved_exception_message(self):
@@ -2557,6 +2547,7 @@ def __get_improved_exception_message(self):
25572547
"Please go to "
25582548
"https://sites.google.com/a/chromium.org/chromedriver/ "
25592549
"and download the latest version to your system PATH! "
2550+
"Or use: ``seleniumbase install chromedriver`` . "
25602551
"Original Exception Message: %s" % exc_message)
25612552
exc_message = update
25622553
return exc_message

0 commit comments

Comments
 (0)