MCPcopy Create free account
hub / github.com/seleniumbase/SeleniumBase / add_fails_or_errors

Method add_fails_or_errors

seleniumbase/plugins/base_plugin.py:297–334  ·  view source on GitHub ↗
(self, test, err)

Source from the content-addressed store, hash-verified

295 )
296
297 def add_fails_or_errors(self, test, err):
298 if self.report_on:
299 self.duration = str(
300 "%.2fs" % (float(time.time()) - float(self.start_time))
301 )
302 if test.id() == "nose.failure.Failure.runTest":
303 return
304 self.failures.append(test.id())
305 self.page_results_list.append(
306 report_helper.process_failures(
307 test, self.test_count, self.duration
308 )
309 )
310 if python3_11_or_newer and py311_patch2:
311 # Handle a bug on Python 3.11 where exceptions aren't seen
312 sb_config._browser_version = None
313 with suppress(Exception):
314 test._BaseCase__set_last_page_screenshot()
315 test._BaseCase__set_last_page_url()
316 test._BaseCase__set_last_page_source()
317 sb_config._browser_version = test._get_browser_version()
318 test._log_fail_data()
319 sb_config._excinfo_tb = err
320 log_path = None
321 source = None
322 if hasattr(sb_config, "_test_logpath"):
323 log_path = sb_config._test_logpath
324 if hasattr(sb_config, "_last_page_source"):
325 source = sb_config._last_page_source
326 if log_path and source:
327 log_helper.log_page_source(log_path, None, source)
328 last_page_screenshot_png = None
329 if hasattr(sb_config, "_last_page_screenshot_png"):
330 last_page_screenshot_png = sb_config._last_page_screenshot_png
331 if log_path and last_page_screenshot_png:
332 log_helper.log_screenshot(
333 log_path, None, last_page_screenshot_png
334 )
335
336 def addFailure(self, test, err, capt=None, tbinfo=None):
337 self.add_fails_or_errors(test, err)

Callers 2

addFailureMethod · 0.95
addErrorMethod · 0.95

Calls 2

_get_browser_versionMethod · 0.80
_log_fail_dataMethod · 0.80

Tested by

no test coverage detected