Skip to content

Keywords run by end_suite are not in the teardown context #4574

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

Open
rousku opened this issue Dec 23, 2022 · 1 comment
Open

Keywords run by end_suite are not in the teardown context #4574

rousku opened this issue Dec 23, 2022 · 1 comment
Milestone

Comments

@rousku
Copy link

rousku commented Dec 23, 2022

If a listener runs a keyword in the end_suite handler, in the context of that keyword, the in_teardown is false.

test.robot

*** Settings ***
Library           ContextAccess.py
Suite Teardown    Run Keywords    In Teardown Should Be True

*** Test Cases ***
Placeholder
    No Operation

Listener.py

from robot.libraries.BuiltIn import BuiltIn

ROBOT_LISTENER_API_VERSION = 2


def end_suite(name, attributes):
    BuiltIn().run_keyword('In Teardown Should Be True')

ContextAccess.py

from robot.running.context import EXECUTION_CONTEXTS
from robot.libraries.BuiltIn import BuiltIn


def in_teardown_should_be_true():
    BuiltIn().run_keyword('Should Be True',
                          EXECUTION_CONTEXTS.current.in_teardown)

Running robot --listener Listener.py .\test.robot results in a failure:
image

@pekkaklarck
Copy link
Member

end_suite isn't exactly the same as teardown, but perhaps using teardown context then would make sense. Need to think a bit more.

@pekkaklarck pekkaklarck added this to the v7.4 milestone May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants