diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index cdc80b1dc0d345..03538a940cb363 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -71,7 +71,7 @@ def testNoArgFunctions(self): NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdb", "uname", "times", "getloadavg", "getegid", "geteuid", "getgid", "getgroups", - "getpid", "getpgrp", "getppid", "getuid", "sync", + "getpid", "getpgrp", "getppid", "getuid", ] for name in NO_ARG_FUNCTIONS: @@ -81,6 +81,13 @@ def testNoArgFunctions(self): posix_func() self.assertRaises(TypeError, posix_func, 1) + # gh-102184: sync() can block for a long time. + @support.requires_resource('walltime') + @unittest.skipUnless(hasattr(posix, 'sync'), 'test needs posix.sync()') + def test_sync(self): + posix.sync() + self.assertRaises(TypeError, posix.sync, 1) + @unittest.skipUnless(hasattr(posix, 'getresuid'), 'test needs posix.getresuid()') def test_getresuid(self):