From e8e77f5a2c07e7dc814290ecc49d00a78d3c68ac Mon Sep 17 00:00:00 2001 From: Bernie Hackett Date: Mon, 27 Mar 2017 13:42:03 -0700 Subject: [PATCH] PYTHON-1227 - Don't use select.POLLNVAL It causes problems with Jython and seems unnecessary since we know the fd represents an open socket. --- pymongo/network.py | 4 ++-- test/test_client.py | 1 - test/test_pooling.py | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pymongo/network.py b/pymongo/network.py index 1b5aeca9c..33fd79791 100644 --- a/pymongo/network.py +++ b/pymongo/network.py @@ -24,8 +24,8 @@ _HAS_POLL = True _EVENT_MASK = 0 try: from select import poll - _EVENT_MASK = (select.POLLIN | select.POLLPRI | select.POLLERR | - select.POLLHUP | select.POLLNVAL) + _EVENT_MASK = ( + select.POLLIN | select.POLLPRI | select.POLLERR | select.POLLHUP) except ImportError: _HAS_POLL = False diff --git a/test/test_client.py b/test/test_client.py index b1df0a1b2..a26ce804a 100644 --- a/test/test_client.py +++ b/test/test_client.py @@ -314,7 +314,6 @@ class TestClient(IntegrationTest): "a closed socket gets replaced from the pool") self.assertFalse(sock_info in server._pool.sockets) - @unittest.skipIf(sys.platform.startswith('java'), 'PYTHON-1227') def test_max_idle_time_checkout(self): # Use high frequency to test _get_socket_no_auth. with client_knobs(kill_cursor_frequency=99999999): diff --git a/test/test_pooling.py b/test/test_pooling.py index 2596213d7..188a394a6 100644 --- a/test/test_pooling.py +++ b/test/test_pooling.py @@ -191,7 +191,6 @@ class TestPooling(_TestPoolingBase): def test_disconnect(self): run_cases(self.c, [InsertOneAndFind, Disconnect, Unique]) - @unittest.skipIf(sys.platform.startswith('java'), 'PYTHON-1227') def test_pool_reuses_open_socket(self): # Test Pool's _check_closed() method doesn't close a healthy socket. cx_pool = self.create_pool(max_pool_size=10) @@ -250,7 +249,6 @@ class TestPooling(_TestPoolingBase): with cx_pool.get_socket({}): pass - @unittest.skipIf(sys.platform.startswith('java'), 'PYTHON-1227') def test_socket_closed(self): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((client_context.host, client_context.port)) @@ -330,7 +328,6 @@ class TestPooling(_TestPoolingBase): sock_info.close() - @unittest.skipIf(sys.platform.startswith('java'), 'PYTHON-1227') def test_no_wait_queue_timeout(self): # Verify get_socket() with no wait_queue_timeout blocks forever. pool = self.create_pool(max_pool_size=1)