forked from robotframework/PythonRemoteServer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamplelibrary.py
More file actions
executable file
·28 lines (19 loc) · 921 Bytes
/
examplelibrary.py
File metadata and controls
executable file
·28 lines (19 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env python
import os
class ExampleRemoteLibrary(object):
"""Example library to be used with Robot Framework's remote server.
This documentation is visible in docs generated by `Libdoc`.
"""
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):
print "Comparing '%s' to '%s'." % (str1, str2)
if not (isinstance(str1, basestring) and isinstance(str2, basestring)):
raise AssertionError("Given strings are not strings.")
if str1 != str2:
raise AssertionError("Given strings are not equal.")
if __name__ == '__main__':
import sys
from robotremoteserver import RobotRemoteServer
RobotRemoteServer(ExampleRemoteLibrary(), *sys.argv[1:])