From 955cda4271104cb19724b91975f600e64e140a44 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 19 Jan 2018 14:10:27 -0500 Subject: [PATCH] bpo-32601: Let test_expanduser use the same user if no others found This happens in the NixOS build sandbox, for example, where the only other user is nobody with home directory /. Signed-off-by: Anders Kaseorg --- Lib/test/test_pathlib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index e56e0d20844ec57..0ae08a273bcaceb 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -2145,6 +2145,9 @@ def test_expanduser(self): otherhome = pwdent.pw_dir.rstrip('/') if othername != username and otherhome: break + else: + othername = username + otherhome = userhome p1 = P('~/Documents') p2 = P('~' + username + '/Documents')