closes bpo-37964: add F_GETPATH command to fcntl (GH-15550)
https://bugs.python.org/issue37964
Automerge-Triggered-By: @benjaminp
diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py
index 5d4abe3..38097db 100644
--- a/Lib/test/test_fcntl.py
+++ b/Lib/test/test_fcntl.py
@@ -144,6 +144,12 @@
self.assertRaises(OverflowError, fcntl.flock, _testcapi.INT_MAX+1,
fcntl.LOCK_SH)
+ @unittest.skipIf(sys.platform != 'darwin', "F_GETPATH is only available on macos")
+ def test_fcntl_f_getpath(self):
+ self.f = open(TESTFN, 'wb')
+ abspath = os.path.abspath(TESTFN)
+ res = fcntl.fcntl(self.f.fileno(), fcntl.F_GETPATH, bytes(len(abspath)))
+ self.assertEqual(abspath, res.decode('utf-8'))
def test_main():
run_unittest(TestFcntl)