Commit 35712c2c authored by Julien Muchembled's avatar Julien Muchembled

WSGI: fix getServerAddress() in tests

parent fe06db19
...@@ -144,6 +144,9 @@ def createServer(application, logger, **kw): ...@@ -144,6 +144,9 @@ def createServer(application, logger, **kw):
**kw **kw
) )
if not hasattr(server, 'addr'): if not hasattr(server, 'addr'):
try:
server.addr = kw['sockets'][0].getsockname()
except KeyError:
server.addr = server.adj.listen[0][3] server.addr = server.adj.listen[0][3]
elif not server.addr: elif not server.addr:
server.addr = server.sockinfo[3] server.addr = server.sockinfo[3]
......
...@@ -98,8 +98,9 @@ class TestInvalidationBug(ERP5TypeTestCase): ...@@ -98,8 +98,9 @@ class TestInvalidationBug(ERP5TypeTestCase):
activity_tool = self.portal.portal_activities activity_tool = self.portal.portal_activities
node_list = list(activity_tool.getProcessingNodeList()) node_list = list(activity_tool.getProcessingNodeList())
node_list.remove(getCurrentNode()) node_list.remove(getCurrentNode())
assert node_list and isinstance(storage, ClientStorage), \ assert node_list and isinstance(storage, ClientStorage), (
"this unit test must be run with at least 2 ZEO clients" node_list, storage,
"this unit test must be run with at least 2 ZEO clients")
### Prepare unit test, to minimize amount of work during critical section ### Prepare unit test, to minimize amount of work during critical section
## make sure activity tool's OOBTree for family mapping is loaded before the test ## make sure activity tool's OOBTree for family mapping is loaded before the test
......
...@@ -166,6 +166,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase): ...@@ -166,6 +166,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
else: else:
webdav_ports = () webdav_ports = ()
sockets.append(s) sockets.append(s)
if verbose:
ZopeTestCase._print(message % (server_type, ip, port)) ZopeTestCase._print(message % (server_type, ip, port))
if webdav_ports: if webdav_ports:
break break
......
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