MCPcopy Index your code
hub / github.com/python/cpython / test_closefd

Method test_closefd

Lib/test/_test_multiprocessing.py:5913–5937  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5911
5912 @warnings_helper.ignore_fork_in_thread_deprecation_warnings()
5913 def test_closefd(self):
5914 if not HAS_REDUCTION:
5915 raise unittest.SkipTest('requires fd pickling')
5916
5917 reader, writer = multiprocessing.Pipe()
5918 fd = self.get_high_socket_fd()
5919 try:
5920 p = multiprocessing.Process(target=self._test_closefds,
5921 args=(writer, fd))
5922 p.start()
5923 writer.close()
5924 e = reader.recv()
5925 join_process(p)
5926 finally:
5927 self.close(fd)
5928 writer.close()
5929 reader.close()
5930
5931 if multiprocessing.get_start_method() == 'fork':
5932 self.assertIs(e, None)
5933 else:
5934 WSAENOTSOCK = 10038
5935 self.assertIsInstance(e, OSError)
5936 self.assertTrue(e.errno == errno.EBADF or
5937 e.winerror == WSAENOTSOCK, e)
5938
5939#
5940# Issue #17097: EINTR should be ignored by recv(), send(), accept() etc

Callers

nothing calls this directly

Calls 12

get_high_socket_fdMethod · 0.95
closeMethod · 0.95
join_processFunction · 0.85
PipeMethod · 0.80
assertIsInstanceMethod · 0.80
assertTrueMethod · 0.80
ProcessMethod · 0.45
startMethod · 0.45
closeMethod · 0.45
recvMethod · 0.45
get_start_methodMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected