Skip to content

Commit 2e01f7d

Browse files
bpo-32601: Let test_expanduser use the same user if no others found. (GH-5246)
This happens in the NixOS build sandbox, for example, where the only other user is nobody with home directory /. (cherry picked from commit 5c0d462) Co-authored-by: Anders Kaseorg <[email protected]>
1 parent f1ee4a2 commit 2e01f7d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/test/test_pathlib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,9 @@ def test_expanduser(self):
21422142
otherhome = pwdent.pw_dir.rstrip('/')
21432143
if othername != username and otherhome:
21442144
break
2145+
else:
2146+
othername = username
2147+
otherhome = userhome
21452148

21462149
p1 = P('~/Documents')
21472150
p2 = P('~' + username + '/Documents')

0 commit comments

Comments
 (0)