diff --git a/Lib/test/test_os/test_posix.py b/Lib/test/test_os/test_posix.py index 0e8495a4eff2ed..8b168ef79572de 100644 --- a/Lib/test/test_os/test_posix.py +++ b/Lib/test/test_os/test_posix.py @@ -412,11 +412,10 @@ def test_posix_fallocate(self): # so skip Solaris-based since they are likely to have ZFS. # issue33655: Also ignore EINVAL on *BSD since ZFS is also # often used there. - if inst.errno == errno.EINVAL and sys.platform.startswith( - ('sunos', 'freebsd', 'openbsd', 'gnukfreebsd')): - raise unittest.SkipTest("test may fail on ZFS filesystems") - elif inst.errno == errno.EOPNOTSUPP and sys.platform.startswith("netbsd"): - raise unittest.SkipTest("test may fail on FFS filesystems") + # gh-148841: unified to one case for EINVAL/EOPNOTSUPP on *BSD + if inst.errno in (errno.EINVAL, errno.EOPNOTSUPP) and sys.platform.startswith( + ('sunos', 'freebsd', 'openbsd', 'netbsd', 'gnukfreebsd')): + raise unittest.SkipTest("test may fail on ZFS / FFS filesystems") else: raise finally: diff --git a/Misc/NEWS.d/next/Tests/2026-04-24-02-12-30.gh-issue-148841.34XIIP.rst b/Misc/NEWS.d/next/Tests/2026-04-24-02-12-30.gh-issue-148841.34XIIP.rst new file mode 100644 index 00000000000000..fe0b6fc1d6d5ff --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2026-04-24-02-12-30.gh-issue-148841.34XIIP.rst @@ -0,0 +1,2 @@ +When calling fallocate() on a zfs filesystem, FreeBSD 15 returns EOPNOTSUPP, +as NetBSD does. This is causing test_os to fail - Handle this case as well.