Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context.execute_steps: Add configuration point to enable/disable the exception tracebacks #983

Open
jenisys opened this issue Dec 12, 2021 · 2 comments

Comments

@jenisys
Copy link
Member

jenisys commented Dec 12, 2021

RELATED TO: Discussion in #981

QUESTION: Is it possible to omit the traceback for the steps which use context.execute_steps() ?

Currently not, as you can see from the referenced implementation of behave.runner:Context.execute_steps().
A configuration point needs to be introduced to be able to configured the desired behaviour
(with tracebacks or without tracebacks). But even without tracebacks this would mean at least two lines in my opinion:
The assertion message (string from AssertionError) and the diagnostics in which dubstep the assertion failed.
In addition, it may be useful to switch on exception-tracebacks if the --verbose option is used.

SEE ALSO:

@berndhahnebach
Copy link

berndhahnebach commented Dec 12, 2021

Actually I do would like to omit even more ... The user should not see a sub step has been executed. Thus this seams what I am after ... here

if not passed:

                if not passed:
                    # -- ISSUE #96: Provide more substep info to diagnose problem.
                    step_line = u"%s %s" % (step.keyword, step.name)
                    # message = "%s SUB-STEP: %s" % \
                    #           (step.status.name.upper(), step_line)
                    message = ""
                    if step.error_message:
                        # message += "\nSubstep info: %s\n" % step.error_message
                        message = "\n%s\n" % step.error_message
                        # message += u"Traceback (of failed substep):\n"
                        # message += u"".join(traceback.format_tb(step.exc_traceback))
                    # message += u"\nTraceback (of context.execute_steps()):"
                    assert False, message

We do use the context.execute_steps() method for translating system. Means any language just uses context.execute_steps() and executes the english test. See https://github.com/IfcOpenShell/IfcOpenShell/tree/4e9a5f246f2260ad6a9c1c6ffa46230a0f8b5914/src/ifcbimtester/bimtester/features/steps/project_setup

@berndhahnebach
Copy link

Mhh but if the linked step has some other problems than the test errors, like some wrong code this error message is omited too if my code is used. Not smart, but fine for me ATM because this is not important for the user and I do know where to activate the error message print of the linked step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants