Guest User

Untitled

a guest
May 7th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. diff --git a/src/bin/stats/tests/test_utils.py b/src/bin/stats/tests/test_utils.py
  2. index 8b45f26..8886ad2 100644
  3. --- a/src/bin/stats/tests/test_utils.py
  4. +++ b/src/bin/stats/tests/test_utils.py
  5. @@ -446,7 +446,7 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
  6. ORIG_SPECFILE_LOCATION = stats_httpd.SPECFILE_LOCATION
  7. def __init__(self, *server_address):
  8. self._started = threading.Event()
  9. - self.__dummy_socks = None # see below
  10. + self.__dummy_sock = None # see below
  11.  
  12. # Prepare commonly used statistics schema and data requested in
  13. # stats-httpd tests. For the purpose of these tests, the content of
  14. @@ -501,10 +501,11 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
  15.  
  16. # replace some (faked) ModuleCCSession methods so we can inspect/fake.
  17. # in order to satisfy select.select() we need some real socket. We
  18. - # use a socketpair(), but won't actually use it for communication.
  19. + # use an unusable AF_UNIX socket; we won't actually use it for
  20. + # communication.
  21. self.cc_session.rpc_call = self.__rpc_call
  22. - self.__dummy_socks = socket.socketpair()
  23. - self.mccs.get_socket = lambda: self.__dummy_socks[0]
  24. + self.__dummy_sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
  25. + self.mccs.get_socket = lambda: self.__dummy_sock
  26.  
  27. def open_mccs(self):
  28. self.mccs = MyModuleCCSession(stats_httpd.SPECFILE_LOCATION,
  29. @@ -515,10 +516,9 @@ class MyStatsHttpd(stats_httpd.StatsHttpd):
  30.  
  31. def close_mccs(self):
  32. super().close_mccs()
  33. - if self.__dummy_socks is not None:
  34. - self.__dummy_socks[0].close()
  35. - self.__dummy_socks[1].close()
  36. - self.__dummy_socks = None
  37. + if self.__dummy_sock is not None:
  38. + self.__dummy_sock.close()
  39. + self.__dummy_sock = None
  40.  
  41. def __rpc_call(self, command, group, params={}):
  42. """Faked ModuleCCSession.rpc_call for tests.
Advertisement
Add Comment
Please, Sign In to add comment