Commit f5639901 authored by Ivan Tyagov's avatar Ivan Tyagov

Fix testOooUnoMimemapper

Due to a5157949 cloudooo will retry 10 times before raising thus take this into account
Raise rather than swallow.

Test do pass at
https://nexedi.erp5.net/test_result_module/20191227-20A35E0F

/reviewed-on !21
parent a5157949
...@@ -22,11 +22,15 @@ def getServiceManager(host, port, uno_path, office_binary_path): ...@@ -22,11 +22,15 @@ def getServiceManager(host, port, uno_path, office_binary_path):
# Connect to the running OpenOffice.org and get its # Connect to the running OpenOffice.org and get its
# context. # context.
# Retry 10 times if needed. # Retry 10 times if needed.
for i in range(10): max_attempts = 10
for i in range(max_attempts):
try: try:
uno_connection = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port)) uno_connection = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port))
break break
except: except:
if i == (max_attempts - 1):
# no use to try, raise accordingly rather than swallow exception
raise
# I don't know how to import com.sun.star.connection.NoConnectException # I don't know how to import com.sun.star.connection.NoConnectException
time.sleep(1) time.sleep(1)
# Get the ServiceManager object # Get the ServiceManager object
......
...@@ -110,6 +110,9 @@ class TestUnoMimeMapper(HandlerTestCase): ...@@ -110,6 +110,9 @@ class TestUnoMimeMapper(HandlerTestCase):
"--office_binary_path=%s" % self.office_binary_path, "--office_binary_path=%s" % self.office_binary_path,
"--hostname=%s" % self.hostname, "--hostname=%s" % self.hostname,
"--port=%s" % self.openoffice_port] "--port=%s" % self.openoffice_port]
# due to a5157949fb5fc9e0c4b0b204f0e737c15498cf38
# cloudooo will retry 10 times before raising thus take this into account
for i in range(10):
stdout, stderr = Popen(command, stdout, stderr = Popen(command,
stdout=PIPE, stdout=PIPE,
stderr=PIPE).communicate() stderr=PIPE).communicate()
......
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