MarketSquare / robotframework-sherlock

Robot Framework code inspector
Apache License 2.0
14 stars 1 forks source link

AttributeError: 'Keyword' object has no attribute 'teardown' #91

Closed nicolasbillamboz-flowbird closed 1 year ago

nicolasbillamboz-flowbird commented 1 year ago

When i run sherlock on a folder containing a unique and very simple test:

*** Test Cases ***
My test
    Log    Hello test

I get the following error:

Sherlock analysis of Robot Framework code:

Using <my_project_root>/sandbox as source repository
Traceback (most recent call last):
  File "<my_project_root>/.venv/bin/sherlock", line 8, in <module>
    sys.exit(run_cli())
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/__init__.py", line 19, in run_cli
    raise err
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/__init__.py", line 9, in run_cli
    runner.run()
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/core.py", line 37, in run
    suite.visit(code_visitor)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/testsuite.py", line 399, in visit
    visitor.visit_suite(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/visitor.py", line 98, in visit_suite
    suite.suites.visit(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/itemlist.py", line 102, in visit
    item.visit(visitor)    # type: ignore
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/testsuite.py", line 399, in visit
    visitor.visit_suite(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/visitor.py", line 90, in visit_suite
    suite.tests.visit(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/itemlist.py", line 102, in visit
    item.visit(visitor)    # type: ignore
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/testcase.py", line 186, in visit
    visitor.visit_test(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/visitor.py", line 157, in visit_test
    test.body.visit(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/itemlist.py", line 102, in visit
    item.visit(visitor)    # type: ignore
  File "<my_project_root>/.venv/lib/python3.8/site-packages/robot/model/keyword.py", line 65, in visit
    visitor.visit_keyword(self)
  File "<my_project_root>/.venv/lib/python3.8/site-packages/sherlock/visitor.py", line 115, in visit_keyword
    kw.teardown.visit(self)
AttributeError: 'Keyword' object has no attribute 'teardown'
Fatal exception occurred. You can create an issue at https://github.com/bhirsz/robotframework-sherlock/issues . Thanks!

Environment

nicolasbillamboz-flowbird commented 1 year ago

@bhirsz you recently fixed and closed https://github.com/MarketSquare/robotframework-sherlock/issues/92, which I reported at the same time of this issue. This one is a blocker, but you haven't commented on it yet. Is it an oversight, or am I too impatient?

bhirsz commented 1 year ago

Don't worry, I'm keeping close look on all issues but I just had time for one issue today and I picked randomly (mostly because it will be released in a few days in single release anyway). I should have more time tommorrow to take a look into this one (though it looks like something I fixed recently).

I also have finally access to real Robot Framework project (I was in company that didnt use RF for some time) so I will try to run some extra tests with Sherlock on bigger projects. It will be a lot easier to spot issues like this one.

bhirsz commented 1 year ago

I have confirmed that this issue was fixed recently in following PR: #77 The problem was that Robot Framework 6.0 deprecated "teardown" attribute (it's part of the "body" in model now). It will be part of the upcoming release.