DetachHead / pytest-robotframework

a pytest plugin that creates robotframework reports for tests written in python and allows you to run robotframework tests with pytest
https://detachhead.github.io/pytest-robotframework/
MIT License
28 stars 2 forks source link

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

Open jackwucn opened 9 months ago

jackwucn commented 9 months ago

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

DetachHead commented 9 months ago

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()
jackwucn commented 8 months ago

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