Skip to content

Commit 48fdbbf

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 0d17e60 commit 48fdbbf

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
@@ -2145,6 +2145,9 @@ def test_expanduser(self):
21452145
otherhome = pwdent.pw_dir.rstrip('/')
21462146
if othername != username and otherhome:
21472147
break
2148+
else:
2149+
othername = username
2150+
otherhome = userhome
21482151

21492152
p1 = P('~/Documents')
21502153
p2 = P('~' + username + '/Documents')

0 commit comments

Comments
 (0)