diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 77f42f7f9c937b..fb1989150c15d8 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -66,8 +66,12 @@ 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", ] + # gh-102184: Don't test sync() by default since it might cause heavy + # I/O and block for a long time. + if support.is_resource_enabled('largefile'): + NO_ARG_FUNCTIONS.append("sync") for name in NO_ARG_FUNCTIONS: posix_func = getattr(posix, name, None) diff --git a/Misc/NEWS.d/next/Tests/2023-02-23-17-38-36.gh-issue-102184.W71J5G.rst b/Misc/NEWS.d/next/Tests/2023-02-23-17-38-36.gh-issue-102184.W71J5G.rst new file mode 100644 index 00000000000000..5bbfc5b2dd5966 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2023-02-23-17-38-36.gh-issue-102184.W71J5G.rst @@ -0,0 +1 @@ +Test ``os.sync()`` only if "largefile" resource is enabled.