Exemple #1
0
    def kwargs(self, **kwargs):
        return self._format_args(**kwargs)

    def args_and_kwargs(self, arg1='default1', arg2='default2', **kwargs):
        return self._format_args(arg1, arg2, **kwargs)

    def varargs_and_kwargs(self, *varargs, **kwargs):
        return self._format_args(*varargs, **kwargs)

    def args_varargs_and_kwargs(self,
                                arg1='default1',
                                arg2='default2',
                                *varargs,
                                **kwargs):
        return self._format_args(arg1, arg2, *varargs, **kwargs)

    def _format_args(self, *args, **kwargs):
        args += tuple('%s:%s' % (k, self._type(v))
                      for k, v in sorted(kwargs.items()))
        return ', '.join(self._type(a) for a in args)

    def _type(self, arg):
        if not isinstance(arg, string_types):
            return '%s (%s)' % (arg, type(arg).__name__)
        return arg


if __name__ == '__main__':
    RemoteServer(Arguments(), *sys.argv[1:])
Exemple #2
0
import sys
import time
from remoteserver import RemoteServer


class Timeouts(object):
    def sleep(self, secs):
        time.sleep(int(secs))


if __name__ == '__main__':
    RemoteServer(Timeouts(), *sys.argv[1:])
Exemple #3
0
class KeywordTags(object):
    def no_tags(self):
        pass

    def doc_contains_tags_only(self):
        """Tags: foo, bar"""

    def doc_contains_tags_after_doc(self):
        """This is by doc.

        My doc has multiple lines.

        Tags: these, are, my, tags
        """

    @keyword
    def empty_robot_tags_means_no_tags(self):
        pass

    @keyword(tags=['foo', 'bar', 'FOO', '42'])
    def robot_tags(self):
        pass

    @keyword(tags=['foo', 'bar'])
    def robot_tags_and_doc_tags(self):
        """Tags: bar, zap"""


if __name__ == '__main__':
    RemoteServer(KeywordTags(), *sys.argv[1:])
Exemple #4
0
 def _register_functions(self):
     RemoteServer._register_functions(self)
     self.register_function(self.get_keyword_types)
import sys

from remoteserver import RemoteServer


class DictResult(object):

    def return_dict(self, **kwargs):
        return kwargs

    def return_nested_dict(self):
        return dict(key='root', nested=dict(key=42, nested=dict(key='leaf')))

    def return_dict_in_list(self):
        return [{'foo': 1}, self.return_nested_dict()]


if __name__ == '__main__':
    RemoteServer(DictResult(), *sys.argv[1:])
 def get_keyword_arguments(self, name):
     if name == 'defaults_as_tuples':
         return [('first', 'eka'), ('second', 2)]
     return RemoteServer.get_keyword_arguments(self, name)