You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python's keyword argument syntax is supported #1383
Python has so called keyword argument syntax which allows defining functions like
def func(**kwargs):
pass
and then calling them like
func(foo=1, bar='two')
In this example the value of kwargs inside func would be a dictionary {'foo': 1, 'bar': 'two'}.
Supporting this syntax with Python based test libraries would sometimes be handy. For example, this would make it easier to add optional configuration parameters to keywords in the new Process library ( issue 485 ). We would like to create keyword like this
def run_process(command, *args, **conf):
# ...
and call it like
Run Process ls -h cwd=/tmp
The idea would be that conf in the above example would contain {'cwd': '/tmp'}.
Most likely this could be implemented so that if a function implementing a keyword has keyword arguments, all arguments at the end of the keyword call in format name=value would be put into it.
If there are also default values, populating them has preferences:
def example(foo='bar', **kwargs):
pass
Example foo=zap kw=arg second=kw_arg
In the above example foo would get value zap and kwargs would be {'kw': 'arg', 'second': 'kw_arg'}.
Activity
spooning commentedon Jun 29, 2014
Done https://code.google.com/p/robotframework/source/detail?r=9ea710550f77d6f544f2687e0f4edb029f9f1a43
spooning commentedon Jun 29, 2014
Other changes in revision 61867ad0783f and revision f8f75df26942.
spooning commentedon Jun 29, 2014
Documentation is covered by issue 1430