pytest-robotframework icon indicating copy to clipboard operation
pytest-robotframework copied to clipboard

is there a way to solve print function log without mark @keyword

Open jackwucn opened this issue 2 years ago • 2 comments

Thanks for this great work. but mark every function with @keyword is really boring. is there a way to print keyword info without mark @keyword. every function can be recognize as keyword default

jackwucn avatar Jan 17 '24 01:01 jackwucn

the problem with making every function a keyword is that most function calls are internal code that you would never want to see in the robot log. for example, the info function from robot.api.logger would fill the log with keywords for all of the internal robot functions in its implementation.

additionally, implementing such a change would be quite difficult, since it would need to somehow wrap every single function in every module dynamically at runtime.

if i updated the pytest_robotframework.keywordify function to allow you to keywordify every function in an individual module, would that help with your use case? for example:

# conftest.py

import some_module

keywordify(some_module)
# test_foo.py

from some_module import foo, bar

def test_foo():
    """both these function calls will show up as keywords in the robot log"""
    foo()
    bar()

DetachHead avatar Jan 17 '24 02:01 DetachHead

thanks for you advice. I write a method to traverse the directory and import all the modules and methods in conftest.

jackwucn avatar Jan 18 '24 02:01 jackwucn