Skip to content

Skipping suite teardown causes a crash if suite setup has been failed or skipped #3896

Closed

Description

@sglaus

Running Robot 4.0 and seeing the following error while executing the "Skip If" keyword in Suite Teardown:

[ ERROR ] Unexpected error: AttributeError: 'SuiteMessage' object has no attribute 'also_teardown_skip_message'
Traceback (most recent call last):
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/utils/application.py", line 83, in _execute
    rc = self.main(arguments, **options)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/run.py", line 447, in main
    result = suite.run(settings)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/model.py", line 292, in run
    self.visit(runner)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/model/testsuite.py", line 195, in visit
    visitor.visit_suite(self)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/model/visitor.py", line 90, in visit_suite
    self.end_suite(suite)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/suiterunner.py", line 104, in end_suite
    self._suite.message = self._suite_status.message
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/status.py", line 147, in message
    return self._my_message()
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/status.py", line 169, in _my_message
    return SuiteMessage(self).message
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/status.py", line 232, in message
    return self._get_message_after_teardown(message)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/status.py", line 258, in _get_message_after_teardown
    return self._format_message_with_teardown_message(message)
  File "/Users/stephenglaus/git/auto/robot4/lib/python3.8/site-packages/robot/running/status.py", line 270, in _format_message_with_teardown_message
    return self.also_teardown_skip_message % (teardown, message)

Version used:

Robot Framework 4.0 (Python 3.8.2 on darwin)

The relevant part of the log is shown below:

20210318 15:48:08.183 - INFO - +- START TEARDOWN: resource.Unconfigure Testbed [ ]
20210318 15:48:08.183 - INFO - +-- START KEYWORD: BuiltIn.Log [ Removing BGP TCP-AO testbed configuration ]
20210318 15:48:08.183 - INFO - Removing BGP TCP-AO testbed configuration
20210318 15:48:08.184 - INFO - +-- END KEYWORD: BuiltIn.Log (1)
20210318 15:48:08.184 - INFO - +-- START KEYWORD: resource.Make Variables Available [ ]
20210318 15:48:08.199 - INFO - +--- START KEYWORD: BuiltIn.Create Dictionary [ r1=${r1} | r2=${r2} | r3=${r3} | r4=${r4} | r5=${r5} | r6=${r6} ]
20210318 15:48:08.200 - INFO - ${all} = {'r1': <lib.features.Setup_tb.vr object at 0x1214363a0>, 'r2': <lib.features.Setup_tb.vr object at 0x121436610>, 'r3': <lib.features.Setup_tb.vr object at 0x123125d30>, 'r4': <lib.features.Setup_tb.vr...
20210318 15:48:08.200 - INFO - +--- END KEYWORD: BuiltIn.Create Dictionary (1)
20210318 15:48:08.201 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${duts} ]
20210318 15:48:08.201 - INFO - ${duts} = {'r1': <lib.features.Setup_tb.vr object at 0x1214363a0>, 'r2': <lib.features.Setup_tb.vr object at 0x121436610>, 'r3': <lib.features.Setup_tb.vr object at 0x123125d30>, 'r4': <lib.features.Setup_tb.vr...
20210318 15:48:08.201 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.201 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r1} ]
20210318 15:48:08.203 - INFO - ${r1} = 

<snip>

20210318 15:48:08.203 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (2)
20210318 15:48:08.203 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r2} ]
20210318 15:48:08.204 - INFO - ${r2} = 

<snip>

20210318 15:48:08.204 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.204 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r3} ]
20210318 15:48:08.205 - INFO - ${r3} = 

<snip>

20210318 15:48:08.205 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.205 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r4} ]
20210318 15:48:08.206 - INFO - ${r4} = 

<snip>

20210318 15:48:08.206 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.207 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r5} ]
20210318 15:48:08.207 - INFO - ${r5} = 

<snip>

20210318 15:48:08.208 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.208 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${r6} ]
20210318 15:48:08.209 - INFO - ${r6} = 

<snip>

20210318 15:48:08.209 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.209 - INFO - +--- START KEYWORD: BuiltIn.Set Suite Variable [ ${all} ]
20210318 15:48:08.210 - INFO - ${all} = {'r1': <lib.features.Setup_tb.vr object at 0x1214363a0>, 'r2': <lib.features.Setup_tb.vr object at 0x121436610>, 'r3': <lib.features.Setup_tb.vr object at 0x123125d30>, 'r4': <lib.features.Setup_tb.vr...
20210318 15:48:08.210 - INFO - +--- END KEYWORD: BuiltIn.Set Suite Variable (1)
20210318 15:48:08.210 - INFO - +-- END KEYWORD: resource.Make Variables Available (26)
20210318 15:48:08.211 - INFO - +-- START KEYWORD: resource.Skip If Feature Not Supported [ ]
20210318 15:48:08.211 - INFO - +--- START KEYWORD: lib.features.Setup_tb.Verify Dut Release [ ${duts} | min_ver=1912 ]
20210318 15:48:08.212 - INFO - ${release_ok} = False
20210318 15:48:08.212 - INFO - +--- END KEYWORD: lib.features.Setup_tb.Verify Dut Release (1)
20210318 15:48:08.212 - INFO - +--- START KEYWORD: BuiltIn.Skip If [ '${release_ok}' == 'False' | BGP TCP-AO requires a minimum version of 1912 ]
20210318 15:48:08.213 - SKIP - BGP TCP-AO requires a minimum version of 1912
20210318 15:48:08.213 - DEBUG - Traceback (most recent call last):
  None
20210318 15:48:08.214 - INFO - +--- END KEYWORD: BuiltIn.Skip If (1)
20210318 15:48:08.214 - INFO - +-- END KEYWORD: resource.Skip If Feature Not Supported (3)
20210318 15:48:08.214 - INFO - +-- START KEYWORD: lib.features.Setup_tb.Cleanup Testbed [ config=config.boot.save | duts=${all} | ignore_error=True ]
20210318 15:48:08.214 - INFO - +-- END KEYWORD: lib.features.Setup_tb.Cleanup Testbed (0)
20210318 15:48:08.215 - INFO - +-- START KEYWORD: BuiltIn.Set Variable [ rm /config/${post_config} ]
20210318 15:48:08.215 - INFO - +-- END KEYWORD: BuiltIn.Set Variable (0)
20210318 15:48:08.215 - INFO - +-- START FOR: ${dut} IN [ @{duts.keys()} ] [ ]
20210318 15:48:08.215 - INFO - +--- START FOR ITERATION: ${dut} = ${dut} [ ]
20210318 15:48:08.215 - INFO - +---- START KEYWORD: BuiltIn.Log [ Removing post-config file on ${dut} ]
20210318 15:48:08.216 - INFO - +---- END KEYWORD: BuiltIn.Log (1)
20210318 15:48:08.216 - INFO - +---- START KEYWORD: TestBed.Execute A Command [ ${${dut}.name} | ${cmd} | sudo=True ]
20210318 15:48:08.216 - INFO - +---- END KEYWORD: TestBed.Execute A Command (0)
20210318 15:48:08.216 - INFO - +--- END FOR ITERATION: ${dut} = ${dut} (1)
20210318 15:48:08.216 - INFO - +-- END FOR: ${dut} IN [ @{duts.keys()} ] (1)
20210318 15:48:08.217 - INFO - +-- START KEYWORD: lib.sys.TestRun.Teardown Testrun Env [ ]
20210318 15:48:08.217 - INFO - +-- END KEYWORD: lib.sys.TestRun.Teardown Testrun Env (0)
20210318 15:48:08.217 - INFO - +- END TEARDOWN: resource.Unconfigure Testbed (34)

Activity

  1. pekkaklarck commented on Mar 18, 2021

    @pekkaklarck
    Member

    Looks bad. I don't have time to investigate this right now but I'll do that later. If you have a simple example demonstrating the problem that'll help.

  2. sglaus commented on Mar 19, 2021

    @sglaus
    Author

    Run the attached test with "-v skip:True" to reproduce the error.

    init.txt
    010__Functional.txt
    resource.txt

  3. pekkaklarck commented on Mar 19, 2021

    @pekkaklarck
    Member

    I was able to reproduce the problem. It occurs also with Skip but only if suite setup has been failed or skipped. The simplest way to reproduce the problem is this:

    *** Settings ***
    Suite Setup       Skip    In setup
    Suite Teardown    Skip    In teardown

    Good news is that this is easy to fix. Another good news is that the problem can be avoided by not skipping a suite both in setup and teardown.

  4. added this to the v4.0.1 milestone on Mar 19, 2021
  5. changed the title [-]Executing "Skip If" in suite teardown causes crash[/-] [+]Skipping suite teardown causes a crash if suite setup has been failed or skipped[/+] on Mar 19, 2021
  6. added theissue type on Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions