(self)
| 2002 | |
| 2003 | @unittest.skipIf(os.name == "nt", "Can't use a socket as a file under Windows") |
| 2004 | def test_makefile_close(self): |
| 2005 | # Issue #5238: creating a file-like object with makefile() shouldn't |
| 2006 | # delay closing the underlying "real socket" (here tested with its |
| 2007 | # file descriptor, hence skipping the test under Windows). |
| 2008 | ss = test_wrap_socket(socket.socket(socket.AF_INET)) |
| 2009 | ss.connect(self.server_addr) |
| 2010 | fd = ss.fileno() |
| 2011 | f = ss.makefile() |
| 2012 | f.close() |
| 2013 | # The fd is still open |
| 2014 | os.read(fd, 0) |
| 2015 | # Closing the SSL socket should close the fd too |
| 2016 | ss.close() |
| 2017 | gc.collect() |
| 2018 | with self.assertRaises(OSError) as e: |
| 2019 | os.read(fd, 0) |
| 2020 | self.assertEqual(e.exception.errno, errno.EBADF) |
| 2021 | |
| 2022 | def test_non_blocking_handshake(self): |
| 2023 | s = socket.socket(socket.AF_INET) |
nothing calls this directly
no test coverage detected