[telepathy-gabble/master] tube tests: do not use the same socket file twice at the same time
Alban Crequy
alban.crequy at collabora.co.uk
Tue Jul 7 06:10:52 PDT 2009
---
tests/twisted/tubes/offer-private-stream-tube.py | 4 ++--
tests/twisted/tubes/tubetestutil.py | 9 +++++----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/tests/twisted/tubes/offer-private-stream-tube.py b/tests/twisted/tubes/offer-private-stream-tube.py
index 1099fbd..35852f4 100644
--- a/tests/twisted/tubes/offer-private-stream-tube.py
+++ b/tests/twisted/tubes/offer-private-stream-tube.py
@@ -41,8 +41,8 @@ def contact_offer_dbus_tube(bytestream, tube_id):
def test(q, bus, conn, stream, bytestream_cls,
address_type, access_control, access_control_param):
- address1 = t.set_up_echo(q, address_type, True)
- address2 = t.set_up_echo(q, address_type, True)
+ address1 = t.set_up_echo(q, address_type, True, streamfile='stream')
+ address2 = t.set_up_echo(q, address_type, True, streamfile='stream2')
t.check_conn_properties(q, conn)
diff --git a/tests/twisted/tubes/tubetestutil.py b/tests/twisted/tubes/tubetestutil.py
index 692e140..123bf29 100644
--- a/tests/twisted/tubes/tubetestutil.py
+++ b/tests/twisted/tubes/tubetestutil.py
@@ -225,12 +225,12 @@ class EchoFactory(EventProtocolFactory):
def _create_protocol(self):
return Echo(self.queue, self.block_reading)
-def set_up_echo(q, address_type, block_reading=False):
+def set_up_echo(q, address_type, block_reading=False, streamfile='stream'):
"""
Sets up an instance of Echo listening on a socket of type @address_type
"""
factory = EchoFactory(q, block_reading)
- return create_server(q, address_type, factory)
+ return create_server(q, address_type, factory, streamfile=streamfile)
# Twisted doesn't set the REUSEADDR option on client sockets.
# As we need this option to be able to bind successively on the same port
@@ -266,11 +266,12 @@ def connect_socket(q, address_type, address, access_control, access_control_para
else:
assert False
-def create_server(q, address_type, factory=None, block_reading=False):
+def create_server(q, address_type, factory=None, block_reading=False,
+ streamfile='stream'):
if factory is None:
factory = EventProtocolFactory(q, block_reading)
if address_type == cs.SOCKET_ADDRESS_TYPE_UNIX:
- path = os.getcwd() + '/stream'
+ path = os.getcwd() + '/' + streamfile
try:
os.remove(path)
except OSError, e:
--
1.5.6.5
More information about the telepathy-commits
mailing list