Skip to content

How to modify allure trace in pytest #2272

Discussion options

You must be logged in to vote

The original exception (which still has the stacktrace) is reported due to the exception chaining feature of Python 3. Use the following syntax to suppress the chaining explicitly:

raise WebDriverException(msg=msg, stacktrace=stacktrace) from None

Clearing the stacktrace of the original exception should work too since it's just a custom attribute managed by Selenium during exception formatting:

try:
    ...
except Exception as e:
    e.stacktrace = None
    raise

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lozik4
Comment options

Answer selected by lozik4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants