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

Method run

seleniumbase/fixtures/base_case.py:17196–17265  ·  view source on GitHub ↗

Overwrite the unittest run() method for Python 3.11 or newer. This method should NOT be called directly from tests.

(self, result=None)

Source from the content-addressed store, hash-verified

17194 method()
17195
17196 def run(self, result=None):
17197 """Overwrite the unittest run() method for Python 3.11 or newer.
17198 This method should NOT be called directly from tests."""
17199 if not python3_11_or_newer:
17200 return super().run(result=result)
17201 if result is None:
17202 result = self.defaultTestResult()
17203 startTestRun = getattr(result, 'startTestRun', None)
17204 stopTestRun = getattr(result, 'stopTestRun', None)
17205 if startTestRun is not None:
17206 startTestRun()
17207 else:
17208 stopTestRun = None
17209 result.startTest(self)
17210 try:
17211 testMethod = getattr(self, self._testMethodName)
17212 if (
17213 getattr(self.__class__, "__unittest_skip__", False)
17214 or getattr(testMethod, "__unittest_skip__", False)
17215 ):
17216 skip_why = (
17217 getattr(self.__class__, '__unittest_skip_why__', '')
17218 or getattr(testMethod, '__unittest_skip_why__', '')
17219 )
17220 self._addSkip(result, self, skip_why)
17221 return result
17222 expecting_failure = (
17223 getattr(self, "__unittest_expecting_failure__", False)
17224 or getattr(testMethod, "__unittest_expecting_failure__", False)
17225 )
17226 outcome = unittest_helper._Outcome(result)
17227 try:
17228 self._outcome = outcome
17229 with outcome.testPartExecutor(self):
17230 self._callSetUp()
17231 if outcome.success:
17232 outcome.expecting_failure = expecting_failure
17233 with outcome.testPartExecutor(self, isTest=True):
17234 self._callTestMethod(testMethod)
17235 outcome.expecting_failure = False
17236 with outcome.testPartExecutor(self):
17237 self._callTearDown()
17238 self.doCleanups()
17239 for test, reason in outcome.skipped:
17240 self._addSkip(result, test, reason)
17241 for test, exc_info in outcome.errors:
17242 if exc_info is not None:
17243 if issubclass(exc_info[0], self.failureException):
17244 result.addFailure(test, exc_info)
17245 else:
17246 result.addError(test, exc_info)
17247 if outcome.success:
17248 if expecting_failure:
17249 if outcome.expectedFailure:
17250 self._addExpectedFailure(
17251 result, outcome.expectedFailure
17252 )
17253 else:

Callers

nothing calls this directly

Calls 8

_addSkipMethod · 0.95
_callTestMethodMethod · 0.95
startTestMethod · 0.80
testPartExecutorMethod · 0.80
addFailureMethod · 0.45
addErrorMethod · 0.45
addSuccessMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected