From 5c0d462689e1a69537eaeba6ab94e3ff3524fc31 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 14 May 2018 10:00:37 -0400 Subject: 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 /. --- 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 5321555..d1a3fba 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -2142,6 +2142,9 @@ class PosixPathTest(_BasePathTest, unittest.TestCase): otherhome = pwdent.pw_dir.rstrip('/') if othername != username and otherhome: break + else: + othername = username + otherhome = userhome p1 = P('~/Documents') p2 = P('~' + username + '/Documents') -- cgit v0.12