Commit 3fd9d2cf authored by Gabriel Monnerat's avatar Gabriel Monnerat

add helper

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41867 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent af107ac5
...@@ -12,6 +12,19 @@ from subprocess import Popen ...@@ -12,6 +12,19 @@ from subprocess import Popen
ENVIRONMENT_PATH = path.abspath(path.dirname(__file__)) ENVIRONMENT_PATH = path.abspath(path.dirname(__file__))
__doc__ = """Unit Test Runner for Cloudooo
usage: %(program)s [options] Unit_Test_Name
Options:
-h, --help Display help documentation
--server_cloudooo_conf=STRING Path to cloudooo configuration file
--paster_path=STRING Path to Paster script
--with-daemon it starts the cloudooo daemon
--with-openoffice it starts one Xvfb and one OpenOffice.org
--with-xvfb it starts one Xvfb only
"""
def wait_liberate_port(hostname, port, timeout_limit=30): def wait_liberate_port(hostname, port, timeout_limit=30):
for n in range(timeout_limit): for n in range(timeout_limit):
if not socketStatus(hostname, port): if not socketStatus(hostname, port):
...@@ -43,25 +56,25 @@ def run_test(test_name): ...@@ -43,25 +56,25 @@ def run_test(test_name):
def run(): def run():
DAEMON = OPENOFFICE = XVFB = False DAEMON = OPENOFFICE = XVFB = False
test_name = sys.argv[-1]
if not path.exists(path.join(ENVIRONMENT_PATH, '%s.py' % test_name)):
exit("%s not exists\n" % test_name)
try: try:
opt_list, arg_list = getopt(sys.argv[1:-1], "", ["with-daemon", opt_list, arg_list = getopt(sys.argv[1:], "h", ["help",
"with-openoffice", "with-daemon",
"with-xvfb", "with-openoffice",
"log_path=", "with-xvfb",
"cloudooo_runner=", "log_path=",
"server_cloudooo_conf=", "cloudooo_runner=",
"timeout_limit=", "server_cloudooo_conf=",
"paster_path="]) "timeout_limit=",
"paster_path="])
except GetoptError, msg: except GetoptError, msg:
exit(msg.msg) exit(msg.msg)
paster_path = "paster" paster_path = "paster"
for opt, arg in opt_list: for opt, arg in opt_list:
if opt in ("-h", "--help"):
print >> sys.stderr, __doc__ % {"program": path.basename(sys.argv[0])}
sys.exit(2)
if opt == "--with-daemon": if opt == "--with-daemon":
DAEMON = True DAEMON = True
elif opt == "--with-openoffice": elif opt == "--with-openoffice":
...@@ -81,11 +94,15 @@ def run(): ...@@ -81,11 +94,15 @@ def run():
timeout_limit = arg timeout_limit = arg
elif opt == "--paster_path": elif opt == "--paster_path":
paster_path = arg paster_path = arg
test_name = sys.argv[-1]
if not path.exists(path.join(ENVIRONMENT_PATH, '%s.py' % test_name)):
exit("%s not exists\n" % test_name)
from cloudoooTestCase import loadConfig, startFakeEnvironment, stopFakeEnvironment from cloudoooTestCase import loadConfig, startFakeEnvironment, stopFakeEnvironment
sys.path.append(ENVIRONMENT_PATH) sys.path.append(ENVIRONMENT_PATH)
config = ConfigParser() config = ConfigParser()
config.read(server_cloudooo_conf) config.read(server_cloudooo_conf)
openoffice_port = int(config.get("app:main", "openoffice_port")) openoffice_port = int(config.get("app:main", "openoffice_port"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment