robotframework / RIDE

Test data editor for Robot Framework
Apache License 2.0
968 stars 382 forks source link

RIDE v2.0b1: RIDE shows the decorator arguments in the keyword help even after using functools.wraps #2407

Open amittendulkar opened 3 years ago

amittendulkar commented 3 years ago

RIDE v2.0b1 running on Python 3.8.5.

Suppose I have a python library like the below. You can notice that I am using a decorator to print the function arguments. To preserve the original keyword function signature, I have used the functools.wraps decorator for the decorator itself.

# Config.py
from functools import wraps
from robot.api.logger import info, debug

def log_func(func):
  @wraps(func)
  def inner1(*args, **kwargs):
    info(f'Inside {func.__name__}')
    debug(f'Arguments: {args}, {kwargs}')
    r_val = func(*args, **kwargs)
    info(f'Exiting {func.__name__}')
    return r_val

  return inner1

class Config:
  @staticmethod
  @log_func
  def activate_config_file(filename: str):
    # Do something with the argument

  # other keywords

After the functools.wraps decorator the LibDoc is able to generate the help of activate_config_file properly. However, RIDE still shows the decorator arguments in its help as follows.

image

amittendulkar commented 3 years ago

This issue is derived from https://github.com/robotframework/robotframework/issues/4058

HelioGuilherme66 commented 3 years ago

@amittendulkar Thanks for the report. RIDE is still using internally the version 3.1.2 of Robot Framework, so new features since 3.2.2 may be missing or incompatible. The effort to adjust to RF 3.2.2 and 4.1.1, has shown to be too big (for me the lonelly maintainer of this project), so I decided to make version 2.0 as a patched version with important features.

It may take a while to have this incorporated, but it may be faster if you create a Pull Request. Thanks.