MCPcopy Create free account
hub / github.com/python/cpython / test_fcntl_f_pipesize

Method test_fcntl_f_pipesize

Lib/test/test_fcntl.py:215–230  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

213 "F_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.")
214 @unittest.skipIf(is_emscripten, "Emscripten pipefs doesn't support these")
215 def test_fcntl_f_pipesize(self):
216 test_pipe_r, test_pipe_w = os.pipe()
217 try:
218 # Get the default pipesize with F_GETPIPE_SZ
219 pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
220 pipesize = pipesize_default // 2 # A new value to detect change.
221 pagesize_default = get_pagesize()
222 if pipesize < pagesize_default: # the POSIX minimum
223 raise unittest.SkipTest(
224 'default pipesize too small to perform test.')
225 fcntl.fcntl(test_pipe_w, fcntl.F_SETPIPE_SZ, pipesize)
226 self.assertEqual(fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ),
227 pipesize)
228 finally:
229 os.close(test_pipe_r)
230 os.close(test_pipe_w)
231
232 def _check_fcntl_not_mutate_len(self, nbytes=None):
233 self.f = open(TESTFN, 'wb')

Callers

nothing calls this directly

Calls 4

get_pagesizeFunction · 0.90
pipeMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected