[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #21636: Fix test_logging, skip UNIX stream (AF_UNIX) tests on

victor.stinner python-checkins at python.org
Mon Jun 2 14:43:37 CEST 2014


http://hg.python.org/cpython/rev/b49e366556ba
changeset: 90967:b49e366556ba
parent: 90965:95b7acdc0f24
parent: 90966:d7a491c6cbdb
user: Victor Stinner <victor.stinner at gmail.com>
date: Mon Jun 02 14:43:24 2014 +0200
summary:
 (Merge 3.4) Issue #21636: Fix test_logging, skip UNIX stream (AF_UNIX) tests on
Windows. Patch written by Claudiu Popa.
files:
 Lib/test/test_logging.py | 22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -860,9 +860,6 @@
 super(TestTCPServer, self).server_bind()
 self.port = self.socket.getsockname()[1]
 
- class TestUnixStreamServer(TestTCPServer):
- address_family = socket.AF_UNIX
-
 class TestUDPServer(ControlMixin, ThreadingUDPServer):
 """
 A UDP server which is controllable using :class:`ControlMixin`.
@@ -910,8 +907,12 @@
 super(TestUDPServer, self).server_close()
 self._closed = True
 
- class TestUnixDatagramServer(TestUDPServer):
- address_family = socket.AF_UNIX
+ if hasattr(socket, "AF_UNIX"):
+ class TestUnixStreamServer(TestTCPServer):
+ address_family = socket.AF_UNIX
+
+ class TestUnixDatagramServer(TestUDPServer):
+ address_family = socket.AF_UNIX
 
 # - end of server_helper section
 
@@ -1452,12 +1453,13 @@
 os.remove(fn)
 return fn
 
+ at unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
 @unittest.skipUnless(threading, 'Threading required for this test.')
 class UnixSocketHandlerTest(SocketHandlerTest):
 
 """Test for SocketHandler with unix sockets."""
 
- if threading:
+ if threading and hasattr(socket, "AF_UNIX"):
 server_class = TestUnixStreamServer
 
 def setUp(self):
@@ -1523,13 +1525,13 @@
 self.handled.wait()
 self.assertEqual(self.log_output, "spam\neggs\n")
 
-
+ at unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
 @unittest.skipUnless(threading, 'Threading required for this test.')
 class UnixDatagramHandlerTest(DatagramHandlerTest):
 
 """Test for DatagramHandler using Unix sockets."""
 
- if threading:
+ if threading and hasattr(socket, "AF_UNIX"):
 server_class = TestUnixDatagramServer
 
 def setUp(self):
@@ -1598,13 +1600,13 @@
 self.handled.wait()
 self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
 
-
+ at unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
 @unittest.skipUnless(threading, 'Threading required for this test.')
 class UnixSysLogHandlerTest(SysLogHandlerTest):
 
 """Test for SysLogHandler with Unix sockets."""
 
- if threading:
+ if threading and hasattr(socket, "AF_UNIX"):
 server_class = TestUnixDatagramServer
 
 def setUp(self):
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /