Commit 7ece6fb6 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[master] use AF_UNIX socket.socket object instead of socket.socketpair()[0]

for "dummy" socket.  in python3.1 the latter is of _socket.socket, which
breaks the assumption of a test.
okayed on bind10-dev.
parent d2861efc
......@@ -446,7 +446,7 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
def __init__(self, *server_address):
self._started = threading.Event()
self.__dummy_socks = None # see below
self.__dummy_sock = None # see below
# Prepare commonly used statistics schema and data requested in
# stats-httpd tests. For the purpose of these tests, the content of
......@@ -501,10 +501,11 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
# replace some (faked) ModuleCCSession methods so we can inspect/fake.
# in order to satisfy we need some real socket. We
# use a socketpair(), but won't actually use it for communication.
# use an unusable AF_UNIX socket; we won't actually use it for
# communication.
self.cc_session.rpc_call = self.__rpc_call
self.__dummy_socks = socket.socketpair()
self.mccs.get_socket = lambda: self.__dummy_socks[0]
self.__dummy_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.mccs.get_socket = lambda: self.__dummy_sock
def open_mccs(self):
self.mccs = MyModuleCCSession(stats_httpd.SPECFILE_LOCATION,
......@@ -515,10 +516,9 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
def close_mccs(self):
if self.__dummy_socks is not None:
self.__dummy_socks = None
if self.__dummy_sock is not None:
self.__dummy_sock = None
def __rpc_call(self, command, group, params={}):
"""Faked ModuleCCSession.rpc_call for tests.
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