test: the fake host never answers with this machine's uid
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / test (3.13) (pull_request) Successful in 1m16s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m32s
driver / publish (pull_request) Skipped

CI runs as root, which the owner step skips, so three owner tests failed there
while they passed for a normal user.
This commit is contained in:
christianmanivong committed 2026-10-30 21:44:40 +01:00
1 parent cb90fa9835
commit 0f0064c2d7
1 file changed
+4 -3
+4 -3
View File
@@ -33,7 +33,7 @@ class _Host(SudoHistoryMixin):
self.home = home
self.bin_dir = bin_dir
self.root = root
#: Who ``id -un`` says the login user is; None for this machine's answer.
#: Who ``id -un`` says the login user is; None for this machine's user name.
self.user: str | None = None
self.ran: list[tuple[str, bool]] = []
@@ -55,8 +55,9 @@ class _Host(SudoHistoryMixin):
}
if command.strip() == "id -u; id -un" and self.root:
return CommandResult("0\nroot\n", "", 0)
if command.strip() == "id -u; id -un" and self.user:
return CommandResult(f"4242\n{self.user}\n", "", 0)
if command.strip() == "id -u; id -un":
# Never this machine's uid: CI runs as root, which the owner step skips.
return CommandResult(f"4242\n{self.user or getpass.getuser()}\n", "", 0)
done = subprocess.run( # noqa: S603 - the test's own scripts
["sh", "-c", command], capture_output=True, text=True, env=env, timeout=timeout
)