From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 14 May 2018 14:22:05 +0000 (-0700) Subject: bpo-32601: Let test_expanduser use the same user if no others found. (GH-5246) X-Git-Tag: v3.7.0b5~133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e01f7d5fe51b492e39d97bf0da2a83f2efb977d;p=python 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 5c0d462689e1a69537eaeba6ab94e3ff3524fc31) Co-authored-by: Anders Kaseorg --- diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 53215550b4..d1a3fba2de 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')