Skip to content

Instantly share code, notes, and snippets.

@carolmirakove
Last active December 17, 2015 20:28
Show Gist options
  • Save carolmirakove/d9ef757929a5942026bd to your computer and use it in GitHub Desktop.
Save carolmirakove/d9ef757929a5942026bd to your computer and use it in GitHub Desktop.
stacktrace of py.saunter and SauceLabs with explicit teardown
============================================== ERRORS ==============================================
________________________ ERROR at teardown of CheckHomePage.test_home_page _________________________
__multicall__ = <MultiCall 0 results, 0 meths, kwargs={'item': <Function 'test_home_page'>, 'nextitem': None}>
item = <Function 'test_home_page'>
def pytest_runtest_teardown(__multicall__, item):
> __multicall__.execute()
conftest.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <MultiCall 0 results, 0 meths, kwargs={'item': <Function 'test_home_page'>, 'nextitem': None}>
def execute(self):
while self.methods:
method = self.methods.pop()
kwargs = self.getkwargs(method)
> res = method(**kwargs)
lib/python2.7/site-packages/_pytest/core.py:370:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
item = <Function 'test_home_page'>, nextitem = None
def pytest_runtest_teardown(item, nextitem):
> item.session._setupstate.teardown_exact(item, nextitem)
lib/python2.7/site-packages/_pytest/runner.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x101a2eb10>, item = <Function 'test_home_page'>
nextitem = None
def teardown_exact(self, item, nextitem):
needed_collectors = nextitem and nextitem.listchain() or []
> self._teardown_towards(needed_collectors)
lib/python2.7/site-packages/_pytest/runner.py:340:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x101a2eb10>, needed_collectors = []
def _teardown_towards(self, needed_collectors):
while self.stack:
if self.stack == needed_collectors[:len(self.stack)]:
break
> self._pop_and_teardown()
lib/python2.7/site-packages/_pytest/runner.py:346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x101a2eb10>
def _pop_and_teardown(self):
colitem = self.stack.pop()
> self._teardown_with_finalization(colitem)
lib/python2.7/site-packages/_pytest/runner.py:315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <_pytest.runner.SetupState object at 0x101a2eb10>, colitem = <Function 'test_home_page'>
def _teardown_with_finalization(self, colitem):
self._callfinalizers(colitem)
if hasattr(colitem, "teardown"):
> colitem.teardown()
lib/python2.7/site-packages/_pytest/runner.py:326:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Function 'test_home_page'>
def teardown(self):
""" perform teardown for this test function. """
if inspect.ismethod(self.obj):
name = 'teardown_method'
else:
name = 'teardown_function'
obj = self.parent.obj
teardown_func_or_meth = xunitsetup(obj, name)
if teardown_func_or_meth is not None:
> teardown_func_or_meth(self.obj)
lib/python2.7/site-packages/_pytest/python.py:461:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_home_page.CheckHomePage object at 0x101d6d290>
method = <bound method CheckHomePage.test_home_page of <test_home_page.CheckHomePage object at 0x101d6d290>>
def teardown_method(self, method):
"""
Default teardown method for all scripts. If run through Sauce Labs OnDemand, the job name, status and tags
are updated. Also the video and server log are downloaded if so configured.
"""
if hasattr(self, "config") and not self.config.getboolean("SauceLabs", "ondemand"):
self.take_named_screenshot("final")
if hasattr(self, "driver"):
> self.driver.quit()
lib/python2.7/site-packages/saunter/testcase/webdriver.py:167:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tailored.webdriver.WebDriver object at 0x101d6d250>
def quit(self):
"""
Quits the driver and closes every associated window.
:Usage:
driver.quit()
"""
try:
> self.execute(Command.QUIT)
lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:455:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <tailored.webdriver.WebDriver object at 0x101d6d250>, driver_command = 'quit'
params = {'sessionId': u'55262d62075941f49060ba28c34d598f'}
def execute(self, driver_command, params=None):
"""
Sends a command to be executed by a command.CommandExecutor.
:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.
:Returns:
The command's JSON response loaded into a dictionary object.
"""
if not params:
params = {'sessionId': self.session_id}
elif 'sessionId' not in params:
params['sessionId'] = self.session_id
params = self._wrap_value(params)
response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)
lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py:165:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x101d6d310>
response = {u'message': u'OKOK', u'status': 13, u'value': {u'message': u'OKOK'}}
def check_response(self, response):
"""
Checks that a JSON response from the WebDriver does not have an error.
:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.
:Raises: If the response contains an error message.
"""
status = response['status']
if status == ErrorCode.SUCCESS:
return
exception_class = ErrorInResponseException
if status == ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status == ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status == ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status == ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status == ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status == ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif status == ErrorCode.INVALID_SELECTOR \
or status == ErrorCode.INVALID_XPATH_SELECTOR \
or status == ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER:
exception_class = InvalidSelectorException
elif status == ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status == ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = WebDriverException
elif status == ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = WebDriverException
elif status == ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status == ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status == ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status == ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status == ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status == ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status == ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
else:
exception_class = WebDriverException
value = response['value']
if isinstance(value, basestring):
if exception_class == ErrorInResponseException:
raise exception_class(response, value)
raise exception_class(value)
message = ''
if 'message' in value:
message = value['message']
screen = None
if 'screen' in value:
screen = value['screen']
stacktrace = None
if 'stackTrace' in value and value['stackTrace']:
stacktrace = []
try:
for frame in value['stackTrace']:
line = self._value_or_default(frame, 'lineNumber', '')
file = self._value_or_default(frame, 'fileName', '<anonymous>')
if line:
file = "%s:%s" % (file, line)
meth = self._value_or_default(frame, 'methodName', '<anonymous>')
if 'className' in frame:
meth = "%s.%s" % (frame['className'], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == ErrorInResponseException:
raise exception_class(response, message)
> raise exception_class(message, screen, stacktrace)
E WebDriverException: Message: u'OKOK'
lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py:158: WebDriverException
----------------------------------------- Captured stdout ------------------------------------------
Link to your job: https://saucelabs.com/jobs/55262d62075941f49060ba28c34d598f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment