]> granicus.if.org Git - python/commitdiff
bpo-32601: Let test_expanduser use the same user if no others found. (GH-5246)
authorAnders Kaseorg <andersk@mit.edu>
Mon, 14 May 2018 14:00:37 +0000 (10:00 -0400)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 14 May 2018 14:00:37 +0000 (17:00 +0300)
This happens in the NixOS build sandbox, for example, where the only
other user is nobody with home directory /.

Lib/test/test_pathlib.py

index 53215550b4354ec74e601d390a65ffc0c13a5871..d1a3fba2ded9083e7ebe617b41da10d9ce34abaf 100644 (file)
@@ -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')