Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(125538)

Unified Diff: Lib/test/test_logging.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_keyword.py ('k') | Lib/test/test_mailcap.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_logging.py Tue Mar 01 10:26:10 2016 +0200
+++ b/Lib/test/test_logging.py Wed Mar 02 00:01:35 2016 +0000
@@ -1447,19 +1447,30 @@ class SocketHandlerTest(BaseTest):
self.root_logger.error('Nor this')
def _get_temp_domain_socket():
fd, fn = tempfile.mkstemp(prefix='test_logging_', suffix='.sock')
os.close(fd)
# just need a name - file can't be present, or we'll get an
# 'address already in use' error.
os.remove(fn)
+ # Check the size of the socket file name. If it exceeds 108
+ # characters (UNIX_PATH_MAX), it can't be used as a UNIX socket.
+ # In this case, fall back to a path constructed somewhere that
+ # is known to be short.
+ if len(fn) > 108:
+ fd, fn = tempfile.mkstemp(prefix='test_logging_', suffix='.sock', dir='/tmp')
+ os.close(fd)
+ # just need a name - file can't be present, or we'll get an
+ # 'address already in use' error.
+ os.remove(fn)
return fn
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
+@unittest.skipIf(sys.platform == 'ios', "iOS doesn't fully support UNIX sockets.")
@unittest.skipUnless(threading, 'Threading required for this test.')
class UnixSocketHandlerTest(SocketHandlerTest):
"""Test for SocketHandler with unix sockets."""
if threading and hasattr(socket, "AF_UNIX"):
server_class = TestUnixStreamServer
@@ -1522,16 +1533,17 @@ class DatagramHandlerTest(BaseTest):
logger.error("spam")
self.handled.wait()
self.handled.clear()
logger.error("eggs")
self.handled.wait()
self.assertEqual(self.log_output, "spam\neggs\n")
@unittest.skipUnless(hasattr(socket, "AF_UNIX"), "Unix sockets required")
+@unittest.skipIf(sys.platform == 'ios', "iOS doesn't fully support UNIX sockets.")
@unittest.skipUnless(threading, 'Threading required for this test.')
class UnixDatagramHandlerTest(DatagramHandlerTest):
"""Test for DatagramHandler using Unix sockets."""
if threading and hasattr(socket, "AF_UNIX"):
server_class = TestUnixDatagramServer
@@ -1597,16 +1609,17 @@ class SysLogHandlerTest(BaseTest):
self.assertEqual(self.log_output, b'<11>sp\xc3\xa4m')
self.handled.clear()
self.sl_hdlr.ident = "h\xe4m-"
logger.error("sp\xe4m")
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.skipIf(sys.platform == 'ios', "iOS doesn't fully support UNIX sockets.")
@unittest.skipUnless(threading, 'Threading required for this test.')
class UnixSysLogHandlerTest(SysLogHandlerTest):
"""Test for SysLogHandler with Unix sockets."""
if threading and hasattr(socket, "AF_UNIX"):
server_class = TestUnixDatagramServer
« no previous file with comments | « Lib/test/test_keyword.py ('k') | Lib/test/test_mailcap.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+