2 new revisions:
Revision: 0b784ed91a61
Author: Pekka Klärck
Date: Fri Sep 16 01:07:39 2011
Log: Unit tests for Python remote server handling new __init__ and
__intro_...
http://code.google.com/p/robotframework/source/detail?r=0b784ed91a61
Revision: e963984b9eef
Author: Pekka Klärck
Date: Fri Sep 16 01:07:46 2011
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=e963984b9eef
==============================================================================
Revision: 0b784ed91a61
Author: Pekka Klärck
Date: Fri Sep 16 01:07:39 2011
Log: Unit tests for Python remote server handling new __init__ and
__intro__ arguments to get_keyword_documentation and get_keyword_arguments
methods.
Update issue 186
Need to also update Python remote server to support this functionality.
Here are unit tests related to it.
http://code.google.com/p/robotframework/source/detail?r=0b784ed91a61
Added:
/tools/remoteserver/test/unit/test_argsdocs.py
Modified:
/tools/remoteserver/example/examplelibrary.py
=======================================
--- /dev/null
+++ /tools/remoteserver/test/unit/test_argsdocs.py Fri Sep 16 01:07:39 2011
@@ -0,0 +1,98 @@
+"""Module doc - used in tests"""
+
+import unittest
+
+from test_robotremoteserver import NonServingRemoteServer
+
+
+class LibraryWithArgsAndDocs:
+ """Intro doc"""
+
+ def __init__(self, i1, i2=1, *i3):
+ """Init doc"""
+
+ def keyword(self, k1, k2=2, *k3):
+ """Keyword doc"""
+
+ def no_doc_or_args(self):
+ pass
+
+
+def keyword_in_module(m1, m2=3, *m3):
+ """Module keyword doc"""
+
+
+class TestDocs(unittest.TestCase):
+
+ def test_keyword_doc(self):
+ self._test_doc('keyword', 'Keyword doc')
+
+ def test_keyword_doc_when_no_doc(self):
+ self._test_doc('no_doc_or_args', '')
+
+ def test_intro_doc(self):
+ self._test_doc('__intro__', 'Intro doc')
+
+ def test_init_doc(self):
+ self._test_doc('__init__', 'Init doc')
+
+ def test_init_doc_when_old_style_lib_has_no_init(self):
+ class OldStyleLibraryWithoutInit: pass
+ self._test_doc('__init__', '', OldStyleLibraryWithoutInit())
+
+ def test_init_doc_when_new_style_lib_has_no_init(self):
+ class NewStyleLibraryWithoutInit(object): pass
+ self._test_doc('__init__', '', NewStyleLibraryWithoutInit())
+
+ def test_keyword_doc_from_module_keyword(self):
+ import test_argsdocs
+ self._test_doc('keyword_in_module', 'Module keyword doc',
test_argsdocs)
+
+ def test_init_doc_from_module(self):
+ import test_argsdocs
+ self._test_doc('__init__', '', test_argsdocs)
+
+ def test_intro_doc_from_module(self):
+ import test_argsdocs
+ self._test_doc('__intro__', 'Module doc - used in tests',
test_argsdocs)
+
+ def _test_doc(self, name, expected,
library=LibraryWithArgsAndDocs(None)):
+ server = NonServingRemoteServer(library)
+ self.assertEquals(server.get_keyword_documentation(name), expected)
+
+
+class TestArgs(unittest.TestCase):
+
+ def test_keyword_args(self):
+ self._test_args('keyword', ['k1', 'k2=2', '*k3'])
+
+ def test_keyword_args_when_no_args(self):
+ self._test_args('no_doc_or_args', [])
+
+ def test_init_args(self):
+ self._test_args('__init__', ['i1', 'i2=1', '*i3'])
+
+ def test_init_args_when_old_style_lib_has_no_init(self):
+ class OldStyleLibraryWithoutInit: pass
+ self._test_args('__init__', [], OldStyleLibraryWithoutInit())
+
+ def test_init_args_when_new_style_lib_has_no_init(self):
+ class NewStyleLibraryWithoutInit(object): pass
+ self._test_args('__init__', [], NewStyleLibraryWithoutInit())
+
+ def test_keyword_doc_from_module_keyword(self):
+ import test_argsdocs
+ self._test_args('keyword_in_module', ['m1', 'm2=3', '*m3'],
+ test_argsdocs)
+
+ def test_init_args_from_module(self):
+ import test_argsdocs
+ self._test_args('__init__', [], test_argsdocs)
+
+ def _test_args(self, name, expected,
library=LibraryWithArgsAndDocs(None)):
+ server = NonServingRemoteServer(library)
+ self.assertEquals(server.get_keyword_arguments(name), expected)
+
+
+if __name__ == '__main__':
+ unittest.main()
=======================================
--- /tools/remoteserver/example/examplelibrary.py Wed Sep 7 14:33:17 2011
+++ /tools/remoteserver/example/examplelibrary.py Fri Sep 16 01:07:39 2011
@@ -5,8 +5,17 @@
class ExampleRemoteLibrary:
+ """Example library to be used with Robot Framework's remote server.
+
+ This documentation is visible in docs generated by _libdoc.py_
+ starting from Robot Framework 2.6.2.
+ """
+
+ def __init__(self):
+ """This library takes no arguments."""
def count_items_in_directory(self, path):
+ """Returns the number of items in the directory specified by
`path`."""
return len([i for i in os.listdir(path) if not i.startswith('.')])
def strings_should_be_equal(self, str1, str2):
==============================================================================
Revision: e963984b9eef
Author: Pekka Klärck
Date: Fri Sep 16 01:07:46 2011
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=e963984b9eef