summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-02 12:43:24 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-02 12:43:24 (GMT)
commit8ff373714c06e0efad62e0b7be68bc5a4a8a6fa5 (patch)
tree27e6da0c388afaca713d549e1a34669c38a08f64
parentf849f46487dd505706c0150ca1967f7031488dfc (diff)
parentec5a860e608fe50827551cd50f67dfeb35424744 (diff)
downloadcpython-8ff373714c06e0efad62e0b7be68bc5a4a8a6fa5.zip
cpython-8ff373714c06e0efad62e0b7be68bc5a4a8a6fa5.tar.gz
cpython-8ff373714c06e0efad62e0b7be68bc5a4a8a6fa5.tar.bz2
(Merge 3.4) Issue #21636: Fix test_logging, skip UNIX stream (AF_UNIX) tests on
Windows. Patch written by Claudiu Popa.
-rw-r--r--Lib/test/test_logging.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index f895878..f765c37 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -860,9 +860,6 @@ if threading:
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 @@ if threading:
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 @@ def _get_temp_domain_socket():
os.remove(fn)
return fn
+@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 @@ class DatagramHandlerTest(BaseTest):
self.handled.wait()
self.assertEqual(self.log_output, "spam\neggs\n")
-
+@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 @@ class SysLogHandlerTest(BaseTest):
self.handled.wait()
self.assertEqual(self.log_output, b'<11>h\xc3\xa4m-sp\xc3\xa4m')
-
+@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):