[Python-checkins] bpo-32601: Let test_expanduser use the same user if no others found. (GH-5246)

Serhiy Storchaka webhook-mailer at python.org
Mon May 14 10:00:41 EDT 2018


https://github.com/python/cpython/commit/5c0d462689e1a69537eaeba6ab94e3ff3524fc31
commit: 5c0d462689e1a69537eaeba6ab94e3ff3524fc31
branch: master
author: Anders Kaseorg <andersk at mit.edu>
committer: Serhiy Storchaka <storchaka at gmail.com>
date: 2018-05-14T17:00:37+03:00
summary:

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 /.

files:
M Lib/test/test_pathlib.py

diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 53215550b435..d1a3fba2ded9 100644
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -2142,6 +2142,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')



More information about the Python-checkins mailing list