Skip to content

Commit 2e332c2

Browse files
author
Alexey Izbyshev
committed
gh-102184: Test os.sync() only if "largefile" resource is enabled
Calling `os.sync()` when the Linux page cache is large and full of dirty pages and the storage device is slow can block the process in "uninterruptible sleep" state for minutes, making the test run unkillable even with SIGKILL. Avoid this by testing `os.sync()` only if "largefile" resource is enabled.
1 parent 5b9573e commit 2e332c2

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_posix.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ def testNoArgFunctions(self):
6666
NO_ARG_FUNCTIONS = [ "ctermid", "getcwd", "getcwdb", "uname",
6767
"times", "getloadavg",
6868
"getegid", "geteuid", "getgid", "getgroups",
69-
"getpid", "getpgrp", "getppid", "getuid", "sync",
69+
"getpid", "getpgrp", "getppid", "getuid",
7070
]
71+
if support.is_resource_enabled('largefile'):
72+
NO_ARG_FUNCTIONS.append("sync")
7173

7274
for name in NO_ARG_FUNCTIONS:
7375
posix_func = getattr(posix, name, None)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test ``os.sync()`` only if "largefile" resource is enabled.

0 commit comments

Comments
 (0)