|
| 1 | +""" |
| 2 | +This tool allows testers to quickly verify pages while assisted by automation. |
| 3 | +""" |
1 | 4 | import os
|
2 | 5 | import shutil
|
3 | 6 | import sys
|
|
9 | 12 | from seleniumbase.config import settings
|
10 | 13 | from seleniumbase.fixtures import js_utils
|
11 | 14 |
|
12 |
| -# This tool allows testers to quickly verify pages while assisted by automation |
| 15 | +python3 = True |
| 16 | +if sys.version_info[0] < 3: |
| 17 | + python3 = False |
13 | 18 |
|
14 | 19 |
|
15 | 20 | class MasterQA(BaseCase):
|
@@ -63,7 +68,7 @@ def tearDown(self):
|
63 | 68 | "WARNING: %s manual checks were skipped! (MasterQA)"
|
64 | 69 | % self.check_count
|
65 | 70 | )
|
66 |
| - if sys.exc_info()[1]: |
| 71 | + if self.__has_exception(): |
67 | 72 | self.__add_failure(sys.exc_info()[1])
|
68 | 73 | self.__process_manual_check_results(self.auto_close_results_page)
|
69 | 74 | super(MasterQA, self).tearDown()
|
@@ -304,6 +309,25 @@ def __wait_for_special_alert_absent(self):
|
304 | 309 | "%s seconds passed without human action! Stopping..." % timeout
|
305 | 310 | )
|
306 | 311 |
|
| 312 | + def __has_exception(self): |
| 313 | + has_exception = False |
| 314 | + if hasattr(sys, "last_traceback") and sys.last_traceback is not None: |
| 315 | + has_exception = True |
| 316 | + elif python3 and hasattr(self, "_outcome"): |
| 317 | + if hasattr(self._outcome, "errors") and self._outcome.errors: |
| 318 | + has_exception = True |
| 319 | + else: |
| 320 | + if python3: |
| 321 | + has_exception = sys.exc_info()[1] is not None |
| 322 | + else: |
| 323 | + if not hasattr(self, "_using_sb_fixture_class") and ( |
| 324 | + not hasattr(self, "_using_sb_fixture_no_class") |
| 325 | + ): |
| 326 | + has_exception = sys.exc_info()[1] is not None |
| 327 | + else: |
| 328 | + has_exception = len(str(sys.exc_info()[1]).strip()) > 0 |
| 329 | + return has_exception |
| 330 | + |
307 | 331 | def __add_failure(self, exception=None):
|
308 | 332 | exc_info = None
|
309 | 333 | if exception:
|
|
0 commit comments