From e6463ebcd82322836917d96cf15cbe1cee5663df Mon Sep 17 00:00:00 2001 From: Noah <33094578+coolreader18@users.noreply.github.com> Date: Mon, 3 May 2021 15:08:30 -0500 Subject: [PATCH] Unskip tests for asynchat and asyncore --- Lib/test/test_asynchat.py | 22 ---------------------- Lib/test/test_asyncore.py | 25 ------------------------- vm/src/stdlib/socket.rs | 5 +++-- 3 files changed, 3 insertions(+), 49 deletions(-) diff --git a/Lib/test/test_asynchat.py b/Lib/test/test_asynchat.py index 62bd322d1..14c0ec43d 100644 --- a/Lib/test/test_asynchat.py +++ b/Lib/test/test_asynchat.py @@ -130,22 +130,16 @@ class TestAsynchat(unittest.TestCase): # chunks back from the server in order to exercise all branches of # async_chat.handle_read - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_line_terminator1(self): # test one-character terminator for l in (1, 2, 3): self.line_terminator_check(b'\n', l) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_line_terminator2(self): # test two-character terminator for l in (1, 2, 3): self.line_terminator_check(b'\r\n', l) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_line_terminator3(self): # test three-character terminator for l in (1, 2, 3): @@ -163,20 +157,14 @@ class TestAsynchat(unittest.TestCase): self.assertEqual(c.contents, [data[:termlen]]) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_numeric_terminator1(self): # check that ints & longs both work (since type is # explicitly checked in async_chat.handle_read) self.numeric_terminator_check(1) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_numeric_terminator2(self): self.numeric_terminator_check(6) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_none_terminator(self): # Try reading a fixed number of bytes s, event = start_echo_server() @@ -190,8 +178,6 @@ class TestAsynchat(unittest.TestCase): self.assertEqual(c.contents, []) self.assertEqual(c.buffer, data) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_simple_producer(self): s, event = start_echo_server() c = echo_client(b'\n', s.port) @@ -203,8 +189,6 @@ class TestAsynchat(unittest.TestCase): self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_string_producer(self): s, event = start_echo_server() c = echo_client(b'\n', s.port) @@ -215,8 +199,6 @@ class TestAsynchat(unittest.TestCase): self.assertEqual(c.contents, [b"hello world", b"I'm not dead yet!"]) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_empty_line(self): # checks that empty lines are handled correctly s, event = start_echo_server() @@ -229,8 +211,6 @@ class TestAsynchat(unittest.TestCase): self.assertEqual(c.contents, [b"hello world", b"", b"I'm not dead yet!"]) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_close_when_done(self): s, event = start_echo_server() s.start_resend_event = threading.Event() @@ -253,8 +233,6 @@ class TestAsynchat(unittest.TestCase): # (which could still result in the client not having received anything) self.assertGreater(len(s.buffer), 0) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_push(self): # Issue #12523: push() should raise a TypeError if it doesn't get # a bytes string diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 089eb18d4..15c42ca58 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -323,8 +323,6 @@ class DispatcherWithSendTests(unittest.TestCase): def tearDown(self): asyncore.close_all() - # TODO: RUSTPYTHON - @unittest.expectedFailure @support.reap_threads def test_send(self): evt = threading.Event() @@ -376,7 +374,6 @@ class FileWrapperTest(unittest.TestCase): def tearDown(self): support.unlink(support.TESTFN) - @unittest.skip("TODO: RUSTPYTHON, thread 'main' panicked at 'assertion failed: `(left != right)` left: `-1`, right: `-1`'") def test_recv(self): fd = os.open(support.TESTFN, os.O_RDONLY) w = asyncore.file_wrapper(fd) @@ -515,8 +512,6 @@ class BaseTestAPI: time.sleep(timeout) self.fail("flag not set") - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_connect(self): # make sure handle_connect is called on connect() @@ -528,8 +523,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_accept(self): # make sure handle_accept() is called when a client connects @@ -549,8 +542,6 @@ class BaseTestAPI: client = BaseClient(self.family, server.address) self.loop_waiting_for_flag(server) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_accepted(self): # make sure handle_accepted() is called when a client connects @@ -575,8 +566,6 @@ class BaseTestAPI: self.loop_waiting_for_flag(server) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_read(self): # make sure handle_read is called on data received @@ -593,8 +582,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_write(self): # make sure handle_write is called @@ -606,8 +593,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_close(self): # make sure handle_close is called when the other end closes # the connection @@ -632,8 +617,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_close_after_conn_broken(self): # Check that ECONNRESET/EPIPE is correctly handled (issues #5661 and # #11265). @@ -666,8 +649,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure @unittest.skipIf(sys.platform.startswith("sunos"), "OOB support is broken on Solaris") def test_handle_expt(self): @@ -694,8 +675,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_handle_error(self): class TestClient(BaseClient): @@ -714,8 +693,6 @@ class BaseTestAPI: client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) - # TODO: RUSTPYTHON - @unittest.expectedFailure def test_connection_attributes(self): server = BaseServer(self.family, self.addr) client = BaseClient(self.family, server.address) @@ -790,8 +767,6 @@ class BaseTestAPI: self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR)) - # TODO: RUSTPYTHON - @unittest.expectedFailure @support.reap_threads def test_quick_connect(self): # see: http://bugs.python.org/issue10340 diff --git a/vm/src/stdlib/socket.rs b/vm/src/stdlib/socket.rs index 26e006c9a..83707dc82 100644 --- a/vm/src/stdlib/socket.rs +++ b/vm/src/stdlib/socket.rs @@ -69,8 +69,8 @@ mod c { pub use winapi::shared::ws2def::*; pub use winapi::um::winsock2::{ SD_BOTH as SHUT_RDWR, SD_RECEIVE as SHUT_RD, SD_SEND as SHUT_WR, SOCK_DGRAM, SOCK_RAW, - SOCK_RDM, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_OOBINLINE, SO_REUSEADDR, - SO_TYPE, *, + SOCK_RDM, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_LINGER, SO_OOBINLINE, + SO_REUSEADDR, SO_TYPE, *, }; } @@ -1558,6 +1558,7 @@ pub fn make_module(vm: &VirtualMachine) -> PyObjectRef { "SO_BROADCAST" => ctx.new_int(c::SO_BROADCAST), "SO_OOBINLINE" => ctx.new_int(c::SO_OOBINLINE), "SO_ERROR" => ctx.new_int(c::SO_ERROR), + "SO_LINGER" => ctx.new_int(c::SO_LINGER), "TCP_NODELAY" => ctx.new_int(c::TCP_NODELAY), "NI_NAMEREQD" => ctx.new_int(c::NI_NAMEREQD), "NI_NOFQDN" => ctx.new_int(c::NI_NOFQDN),