summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fcntl.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fcntl.py')
-rw-r--r--Lib/test/test_fcntl.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 7e10920..8d6e9ff 100644
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -190,6 +190,19 @@ class TestFcntl(unittest.TestCase):
res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(expected)))
self.assertEqual(expected, res)
+ @unittest.skipIf(not (hasattr(fcntl, "F_SETPIPE_SZ") and hasattr(fcntl, "F_GETPIPE_SZ")),
+ "F_SETPIPE_SZ and F_GETPIPE_SZ are not available on all unix platforms.")
+ def test_fcntl_f_pipesize(self):
+ test_pipe_r, test_pipe_w = os.pipe()
+ # Get the default pipesize with F_GETPIPE_SZ
+ pipesize_default = fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ)
+ # Multiply the default with 2 to get a new value.
+ fcntl.fcntl(test_pipe_w, fcntl.F_SETPIPE_SZ, pipesize_default * 2)
+ self.assertEqual(fcntl.fcntl(test_pipe_w, fcntl.F_GETPIPE_SZ), pipesize_default * 2)
+ os.close(test_pipe_r)
+ os.close(test_pipe_w)
+
+
def test_main():
run_unittest(TestFcntl)