(self)
| 2219 | |
| 2220 | @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows") |
| 2221 | def test_makefile_close(self): |
| 2222 | # Issue #5238: creating a file-like object with makefile() shouldn't |
| 2223 | # delay closing the underlying "real socket" (here tested with its |
| 2224 | # file descriptor, hence skipping the test under Windows). |
| 2225 | ss = test_wrap_socket(socket.socket(socket.AF_INET)) |
| 2226 | ss.connect(self.server_addr) |
| 2227 | fd = ss.fileno() |
| 2228 | f = ss.makefile() |
| 2229 | f.close() |
| 2230 | # The fd is still open |
| 2231 | os.read(fd, 0) |
| 2232 | # Closing the SSL socket should close the fd too |
| 2233 | ss.close() |
| 2234 | gc.collect() |
| 2235 | with self.assertRaises(OSError) as e: |
| 2236 | os.read(fd, 0) |
| 2237 | self.assertEqual(e.exception.errno, errno.EBADF) |
| 2238 | |
| 2239 | def test_non_blocking_handshake(self): |
| 2240 | s = socket.socket(socket.AF_INET) |
nothing calls this directly
no test coverage detected