Kaydet (Commit) 6c98339f authored tarafından Markus Mohrhard's avatar Markus Mohrhard

uitest: some pep8 fixes

Change-Id: Ib889604f1b6d11e874c27fb5d2757a792a687366
üst 21248f90
...@@ -22,6 +22,7 @@ except ImportError: ...@@ -22,6 +22,7 @@ except ImportError:
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
raise raise
class OfficeConnection: class OfficeConnection:
def __init__(self, args): def __init__(self, args):
self.args = args self.args = args
...@@ -50,10 +51,10 @@ class OfficeConnection: ...@@ -50,10 +51,10 @@ class OfficeConnection:
self.xContext = self.connect(socket) self.xContext = self.connect(socket)
def bootstrap(self, soffice, userdir, socket): def bootstrap(self, soffice, userdir, socket):
argv = [ soffice, "--accept=" + socket + ";urp", argv = [soffice, "--accept=" + socket + ";urp",
"-env:UserInstallation=" + userdir, "-env:UserInstallation=" + userdir,
"--quickstart=no", "--nofirststartwizard", "--quickstart=no", "--nofirststartwizard",
"--norestore", "--nologo" ] "--norestore", "--nologo"]
if "--valgrind" in self.args: if "--valgrind" in self.args:
argv.append("--valgrind") argv.append("--valgrind")
...@@ -80,7 +81,6 @@ class OfficeConnection: ...@@ -80,7 +81,6 @@ class OfficeConnection:
try: try:
xContext = xUnoResolver.resolve(url) xContext = xUnoResolver.resolve(url)
return xContext return xContext
# except com.sun.star.connection.NoConnectException
except pyuno.getClass("com.sun.star.connection.NoConnectException"): except pyuno.getClass("com.sun.star.connection.NoConnectException"):
print("NoConnectException: sleeping...") print("NoConnectException: sleeping...")
time.sleep(1) time.sleep(1)
...@@ -95,7 +95,6 @@ class OfficeConnection: ...@@ -95,7 +95,6 @@ class OfficeConnection:
"com.sun.star.frame.Desktop", self.xContext) "com.sun.star.frame.Desktop", self.xContext)
xDesktop.terminate() xDesktop.terminate()
print("...done") print("...done")
# except com.sun.star.lang.DisposedException:
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"): except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
print("caught UnknownPropertyException while TearDown") print("caught UnknownPropertyException while TearDown")
pass # ignore, also means disposed pass # ignore, also means disposed
...@@ -144,23 +143,29 @@ class PersistentConnection: ...@@ -144,23 +143,29 @@ class PersistentConnection:
def __init__(self, args): def __init__(self, args):
self.args = args self.args = args
self.connection = None self.connection = None
def getContext(self): def getContext(self):
return self.connection.xContext return self.connection.xContext
def setUp(self): def setUp(self):
assert(not self.connection) assert(not self.connection)
conn = OfficeConnection(self.args) conn = OfficeConnection(self.args)
conn.setUp() conn.setUp()
self.connection = conn self.connection = conn
def preTest(self): def preTest(self):
assert(self.connection) assert(self.connection)
def postTest(self): def postTest(self):
assert(self.connection) assert(self.connection)
def tearDown(self): def tearDown(self):
if self.connection: if self.connection:
try: try:
self.connection.tearDown() self.connection.tearDown()
finally: finally:
self.connection = None self.connection = None
def kill(self): def kill(self):
if self.connection and self.connection.soffice: if self.connection and self.connection.soffice:
self.connection.soffice.kill() self.connection.soffice.kill()
......
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