MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_makefile_close

Method test_makefile_close

Lib/test/test_ssl.py:2004–2020  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers

nothing calls this directly

Calls 10

test_wrap_socketFunction · 0.85
socketMethod · 0.80
collectMethod · 0.80
connectMethod · 0.45
filenoMethod · 0.45
makefileMethod · 0.45
closeMethod · 0.45
readMethod · 0.45
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected