]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-148853: Catch PermissionError in test in_systemd_nspawn_sync_suppressed() (#148854)
authorNick Begg <nick@stunttruck.net>
Mon, 15 Jun 2026 14:25:08 +0000 (16:25 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Jun 2026 14:25:08 +0000 (16:25 +0200)
/run/ on my FreeBSD install is not readable causing failing test.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Lib/test/support/__init__.py
Misc/NEWS.d/next/Tests/2026-04-24-01-38-56.gh-issue-148853._uM4_Q.rst [new file with mode: 0644]

index cd85ef60a80f4bff8ae4ba52d0d506188a3d68aa..e9966e1f7a6d495f3480c491524495599fcb516e 100644 (file)
@@ -3159,7 +3159,7 @@ def in_systemd_nspawn_sync_suppressed() -> bool:
         with open("/run/systemd/container", "rb") as fp:
             if fp.read().rstrip() != b"systemd-nspawn":
                 return False
-    except FileNotFoundError:
+    except (FileNotFoundError, PermissionError):
         return False
 
     # If systemd-nspawn is used, O_SYNC flag will immediately
diff --git a/Misc/NEWS.d/next/Tests/2026-04-24-01-38-56.gh-issue-148853._uM4_Q.rst b/Misc/NEWS.d/next/Tests/2026-04-24-01-38-56.gh-issue-148853._uM4_Q.rst
new file mode 100644 (file)
index 0000000..9d3fbc2
--- /dev/null
@@ -0,0 +1,2 @@
+Fix tests failing on FreeBSD in test.support's
+in_systemd_nspawn_sync_suppressed()  due to unreadable /run directory.