[Jython-checkins] jython: Suppress stack dumps from test_select and test_socket (see #2517).

jeff.allen jython-checkins at python.org
Sun Mar 19 12:24:45 EDT 2017


https://hg.python.org/jython/rev/aef41d53f55e
changeset:   8066:aef41d53f55e
parent:      8064:2c0ce625b440
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Sun Mar 19 11:02:43 2017 +0000
summary:
  Suppress stack dumps from test_select and test_socket (see #2517).

Tests pass functionally. This change suppresses the stack dumps that
appear to result from unsequenced tear-down.

files:
  Lib/test/test_select.py |  14 +++++++++++++-
  Lib/test/test_socket.py |  15 +++++++++++++++
  2 files changed, 28 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -6,13 +6,18 @@
 import select
 import socket
 import sys
-import test_socket
+from test import test_socket
 import unittest
 from test import test_support
 
 HOST = test_socket.HOST
 PORT = test_socket.PORT + 100
 
+if test_support.is_jython:
+    import java.util.logging
+    from test.test_socket import _set_java_logging
+
+
 class SelectWrapper:
 
     def __init__(self):
@@ -179,6 +184,13 @@
 
 def test_main():
 
+    if test_support.is_jython:
+        # Netty logs stack dumps when we destroy sockets after their parent
+        # group, see http://bugs.jython.org/issue2517 . Is this a real bug?
+        # For now, treat as inconvenient artifact of test.
+        _set_java_logging("io.netty.channel.ChannelInitializer",
+                          java.util.logging.Level.SEVERE)
+
     tests = [TestSelectInvalidParameters,
              TestSelectClientSocket,
              TestPollClientSocket,
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -31,6 +31,10 @@
     import _socket
     _socket._NUM_THREADS = 5
 
+    import java.util.logging
+    def _set_java_logging(name, level):
+        java.util.logging.Logger.getLogger(name).setLevel(level)
+
 
 class SocketTCPTest(unittest.TestCase):
 
@@ -2620,6 +2624,16 @@
 
 
 def test_main():
+
+    if test_support.is_jython:
+        # Netty logs stack dumps when we destroy sockets after their parent
+        # group, see http://bugs.jython.org/issue2517 . Is this a real bug?
+        # For now, treat as inconvenient artifact of test.
+        _set_java_logging("io.netty.channel.ChannelInitializer",
+                          java.util.logging.Level.SEVERE)
+        _set_java_logging("io.netty.util.concurrent.DefaultPromise",
+                          java.util.logging.Level.OFF)
+
     tests = [
         GeneralModuleTests,
         IPAddressTests,
@@ -2672,5 +2686,6 @@
     suites = [unittest.makeSuite(klass, 'test') for klass in tests]
     test_support._run_suite(unittest.TestSuite(suites))
 
+
 if __name__ == "__main__":
     test_main()

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list