https://github.com/python/cpython/commit/c91586bdef1e638bea330e6447be8bcf482d758c
commit: c91586bdef1e638bea330e6447be8bcf482d758c
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: hugovk <[email protected]>
date: 2026-08-12T15:43:28+03:00
summary:

[3.15] gh-102184: Test os.sync() only if the "walltime" resource is enabled 
(GH-155448) (#155461)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Alexey Izbyshev <[email protected]>

files:
M Lib/test/test_os/test_posix.py

diff --git a/Lib/test/test_os/test_posix.py b/Lib/test/test_os/test_posix.py
index 1d2ac9664d38f6c..d439eda330bf6cf 100644
--- a/Lib/test/test_os/test_posix.py
+++ b/Lib/test/test_os/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):

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to